From: Mike Bayer Date: Sun, 17 Oct 2010 03:50:33 +0000 (-0400) Subject: note expire_on_commit in the docstring for commit() as well X-Git-Tag: rel_0_6_5~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b0fc34b729e201e7693f0d96c4b5a425b33b48a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git note expire_on_commit in the docstring for commit() as well --- 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