]> 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:38:54 +0000 (16:38 -0400)
commit370624ce0eab6439352eaf502a222a7bf415dc14
treeadcfc74de06cd9b2f36c25481a38c3103e930dc8
parente760e0e1fe229766734abde6b438d75320bdac48
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
(cherry picked from commit c4abf5a44249fa42ae9c5d5c3035b8258c6d92b6)
doc/build/changelog/unreleased_14/7272.rst [new file with mode: 0644]
lib/sqlalchemy/future/engine.py
test/engine/test_execute.py