]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Don't discard inactive transaction until it is explicitly rolled back
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 7 Jun 2019 15:19:23 +0000 (11:19 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 10 Jun 2019 16:56:32 +0000 (12:56 -0400)
commit85568fc596c301563270efe217715f14aea8aa19
tree7ff10cfbaa8b5079b30a852e7a256cbd08ea8ffc
parentb0bf421f1b12eeedd77ec6c39df8e5e6cc1fcc3f
Don't discard inactive transaction until it is explicitly rolled back

The :class:`.Connection` object will now not clear a rolled-back
transaction  until the outermost transaction is explicitly rolled back.
This is essentially the same behavior that the ORM :class:`.Session` has
had for a long time, where an explicit call to ``.rollback()`` on all
enclosing transactions is required for the transaction to logically clear,
even though the DBAPI-level transaction has already been rolled back.
The new behavior helps with situations such as the "ORM rollback test suite"
pattern where the test suite rolls the transaction back within the ORM
scope, but the test harness which seeks to control the scope of the
transaction externally does not expect a new transaction to start
implicitly.

Fixes: #4712
Change-Id: Ibc6c8d981cff31594a5d26dd5203fd9cfcea1c74
doc/build/changelog/migration_14.rst
doc/build/changelog/unreleased_14/4712.rst [new file with mode: 0644]
doc/build/errors.rst
lib/sqlalchemy/engine/base.py
test/dialect/test_sqlite.py
test/engine/test_transaction.py