summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine/result.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-02-04 09:04:49 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-02-04 12:49:24 -0500
commitfaa9ef2cff53bde291df5ac3b5c4ed8f665ecd8c (patch)
treee33df958d54550f88909793d8a4bdf9c3e655b3b /lib/sqlalchemy/engine/result.py
parentb93cef577d6471aa18a6b1cde8a97598fc837377 (diff)
downloadsqlalchemy-faa9ef2cff53bde291df5ac3b5c4ed8f665ecd8c.tar.gz
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
Diffstat (limited to 'lib/sqlalchemy/engine/result.py')
-rw-r--r--lib/sqlalchemy/engine/result.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/sqlalchemy/engine/result.py b/lib/sqlalchemy/engine/result.py
index 3f916fea0..5970e2448 100644
--- a/lib/sqlalchemy/engine/result.py
+++ b/lib/sqlalchemy/engine/result.py
@@ -268,6 +268,7 @@ class ResultInternal(InPlaceGenerative):
_generate_rows = True
_unique_filter_state = None
_post_creational_filter = None
+ _is_cursor = False
@HasMemoized.memoized_attribute
def _row_getter(self):