]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Dont return outer transaction for _subtrans flag
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Apr 2021 15:09:16 +0000 (11:09 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 9 Apr 2021 15:55:43 +0000 (11:55 -0400)
commit5ba31b5a8768e1ca1a08a82144ec0e726d8357c1
treef37a132eb427774685b7627c6b1997c084f2ca89
parentd868f7914cd0617d529a6067e8ec7843692f8937
Dont return outer transaction for _subtrans flag

Fixed critical regression where the :class:`_orm.Session` could fail to
"autobegin" a new transaction when a flush occurred without an existing
transaction in place, implicitly placing the :class:`_orm.Session` into
legacy autocommit mode which commit the transaction. The
:class:`_orm.Session` now has a check that will prevent this condition from
occurring, in addition to repairing the flush issue.

Additionally, scaled back part of the change made as part of :ticket:`5226`
which can run autoflush during an unexpire operation, to not actually
do this in the case of a :class:`_orm.Session` using legacy
:paramref:`_orm.Session.autocommit` mode, as this incurs a commit within
a refresh operation.

Fixes: #6233
Change-Id: Ia980e62a090e39e3e2a7fb77c95832ae784cc9a5
doc/build/changelog/unreleased_14/6233.rst [new file with mode: 0644]
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/session.py
test/orm/test_session.py