summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/asyncio/result.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/result.py')
-rw-r--r--lib/sqlalchemy/ext/asyncio/result.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/result.py b/lib/sqlalchemy/ext/asyncio/result.py
index a9db822a6..d0337554c 100644
--- a/lib/sqlalchemy/ext/asyncio/result.py
+++ b/lib/sqlalchemy/ext/asyncio/result.py
@@ -710,7 +710,14 @@ _RT = TypeVar("_RT", bound="Result")
async def _ensure_sync_result(result: _RT, calling_method: Any) -> _RT:
cursor_result: CursorResult
- if not result._is_cursor:
+
+ try:
+ is_cursor = result._is_cursor
+ except AttributeError:
+ # legacy execute(DefaultGenerator) case
+ return result
+
+ if not is_cursor:
cursor_result = getattr(result, "raw", None) # type: ignore
else:
cursor_result = result # type: ignore