]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Ensure autobegin occurs for attribute changes; Document autobegin
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Apr 2021 13:50:50 +0000 (09:50 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Apr 2021 16:17:46 +0000 (12:17 -0400)
commit45c981a06cc54028aff24e035366ca921b0cc1de
treec65c24fb1defcfc7dc434cb1208049c4ed35967f
parent1443945e61f1f113e46a5044315a91558d4d232a
Ensure autobegin occurs for attribute changes; Document autobegin

The Session autobegin feature was not anticipated as having
any behavioral changes other than the event hook being called
at a different time, however as autobegin impacts the behavior
of the commit() and rollback() methods in that they can now
be no-ops in non-autocommit mode, document the behavior fully.

Fixed issue where the new :ref:`session_autobegin` behavior failed to
"autobegin" in the case where an existing persistent object has an
attribute change, which would then impact the behavior of
:meth:`_orm.Session.rollback` in that no snapshot was created to be rolled
back. The "attribute modify" mechanics have been updated to ensure
"autobegin", which does not perform any database work, does occur when
persistent attributes change in the same manner as when
:meth:`_orm.Session.add` is called. This is a regression as in 1.3, the
rollback() method always had a transaction to roll back and would expire
every time.

Fixes: #6360
Fixes: #6359
Change-Id: I69f231a206f49e3231275d23bbe2cafd4e2bf3ba
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/6360.rst [new file with mode: 0644]
doc/build/orm/session_basics.rst
lib/sqlalchemy/orm/session.py
lib/sqlalchemy/orm/state.py
test/orm/test_session.py
test/profiles.txt