]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use full context manager flow for future.Engine.begin()
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 1 Nov 2021 20:36:51 +0000 (16:36 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 1 Nov 2021 20:37:31 +0000 (16:37 -0400)
commitc4abf5a44249fa42ae9c5d5c3035b8258c6d92b6
tree1b5e16b85b505ce983706b5d8847c79b7b91ff35
parenta99ea884403de1e1f762e9b1eb635d7fc6ef8e6f
use full context manager flow for future.Engine.begin()

Fixed issue in future :class:`_future.Engine` where calling upon
:meth:`_future.Engine.begin` and entering the context manager would not
close the connection if the actual BEGIN operation failed for some reason,
such as an event handler raising an exception; this use case failed to be
tested for the future version of the engine. Note that the "future" context
managers which handle ``begin()`` blocks in Core and ORM don't actually run
the "BEGIN" operation until the context managers are actually entered. This
is different from the legacy version which runs the "BEGIN" operation up
front.

Fixes: #7272
Change-Id: I9667ac0861a9e007c4b3dfcf0fcf0829038a8711
doc/build/changelog/unreleased_14/7272.rst [new file with mode: 0644]
lib/sqlalchemy/future/engine.py
test/engine/test_execute.py