]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
ensure exception raised for all stream w/ sync result
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Feb 2022 14:04:49 +0000 (09:04 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 4 Feb 2022 17:49:49 +0000 (12:49 -0500)
commit2df46ea04ff121ef99e1a9cbac705d3f937c3c15
treeff853086a2b3ea7647732fea3823e6153ac51523
parent2eac6545ad08db83954dd3afebf4894a0acb0cea
ensure exception raised for all stream w/ sync result

Fixed issue where the :meth:`_asyncio.AsyncSession.execute` method failed
to raise an informative exception if the ``stream_results`` execution
option were used, which is incompatible with a sync-style
:class:`_result.Result` object. An exception is now raised in this scenario
in the same way one is already raised when using ``stream_results`` in
conjunction with the :meth:`_asyncio.AsyncConnection.execute` method.
Additionally, for improved stability with state-sensitive dialects such as
asyncmy, the cursor is now closed when this error condition is raised;
previously with the asyncmy dialect, the connection would go into an
invalid state with unconsumed server side results remaining.

Fixes: #7667
Change-Id: I6eb7affe08584889b57423a90258295f8b7085dc
(cherry picked from commit faa9ef2cff53bde291df5ac3b5c4ed8f665ecd8c)
doc/build/changelog/unreleased_14/7667.rst [new file with mode: 0644]
lib/sqlalchemy/engine/cursor.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/ext/asyncio/engine.py
lib/sqlalchemy/ext/asyncio/result.py
lib/sqlalchemy/ext/asyncio/session.py
test/ext/asyncio/test_engine_py3k.py
test/ext/asyncio/test_session_py3k.py