From 5b0fc34b729e201e7693f0d96c4b5a425b33b48a Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 16 Oct 2010 23:50:33 -0400 Subject: [PATCH] note expire_on_commit in the docstring for commit() as well --- lib/sqlalchemy/orm/session.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 95d29812e5..a8d3ab2998 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -593,9 +593,16 @@ class Session(object): def commit(self): """Flush pending changes and commit the current transaction. - + If no transaction is in progress, this method raises an InvalidRequestError. + + By default, the :class:`.Session` also expires all database + loaded state on all ORM-managed attributes after transaction commit. + This so that subsequent operations load the most recent + data from the database. This behavior can be disabled using + the ``expire_on_commit=False`` option to :func:`.sessionmaker` or + the :class:`.Session` constructor. If a subtransaction is in effect (which occurs when begin() is called multiple times), the subtransaction will be closed, and the next call -- 2.47.2