From: Mike Bayer Date: Thu, 2 Jun 2011 16:20:24 +0000 (-0400) Subject: alleviate transaction confusion which may occur from reading just the "commit" doc X-Git-Tag: rel_0_7_1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf0890c6694bd6464a0821e807d425111c9868c5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git alleviate transaction confusion which may occur from reading just the "commit" doc --- diff --git a/doc/build/orm/session.rst b/doc/build/orm/session.rst index 359f1a6c1d..74c4a9b3f2 100644 --- a/doc/build/orm/session.rst +++ b/doc/build/orm/session.rst @@ -636,10 +636,18 @@ transaction. It always issues :func:`~sqlalchemy.orm.session.Session.flush` beforehand to flush any remaining state to the database; this is independent of the "autoflush" setting. If no transaction is present, it raises an error. Note that the default behavior of the :class:`~sqlalchemy.orm.session.Session` -is that a transaction is always present; this behavior can be disabled by +is that a "transaction" is always present; this behavior can be disabled by setting ``autocommit=True``. In autocommit mode, a transaction can be initiated by calling the :func:`~sqlalchemy.orm.session.Session.begin` method. +.. note:: The term "transaction" here refers to a transactional + construct within the :class:`.Session` itself which may be + maintaining zero or more actual database (DBAPI) transactions. An individual + DBAPI connection begins participation in the "transaction" as it is first + used to execute a SQL statement, then remains present until the session-level + "transaction" is completed. See :ref:`unitofwork_transaction` for + further detail. + Another behavior of :func:`~sqlalchemy.orm.session.Session.commit` is that by default it expires the state of all instances present after the commit is complete. This is so that when the instances are next accessed, either through