From bf0890c6694bd6464a0821e807d425111c9868c5 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 2 Jun 2011 12:20:24 -0400 Subject: [PATCH] alleviate transaction confusion which may occur from reading just the "commit" doc --- doc/build/orm/session.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.39.5