diff options
Diffstat (limited to 'lib/sqlalchemy/ext/asyncio/result.py')
-rw-r--r-- | lib/sqlalchemy/ext/asyncio/result.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/sqlalchemy/ext/asyncio/result.py b/lib/sqlalchemy/ext/asyncio/result.py index 8f1c07fd8..41ead5ee2 100644 --- a/lib/sqlalchemy/ext/asyncio/result.py +++ b/lib/sqlalchemy/ext/asyncio/result.py @@ -47,11 +47,21 @@ class AsyncCommon(FilterResult[_R]): _real_result: Result[Any] _metadata: ResultMetaData - async def close(self) -> None: + async def close(self) -> None: # type: ignore[override] """Close this result.""" await greenlet_spawn(self._real_result.close) + @property + def closed(self) -> bool: + """proxies the .closed attribute of the underlying result object, + if any, else raises ``AttributeError``. + + .. versionadded:: 2.0.0b3 + + """ + return self._real_result.closed # type: ignore + SelfAsyncResult = TypeVar("SelfAsyncResult", bound="AsyncResult[Any]") @@ -96,6 +106,16 @@ class AsyncResult(AsyncCommon[Row[_TP]]): ) @property + def closed(self) -> bool: + """proxies the .closed attribute of the underlying result object, + if any, else raises ``AttributeError``. + + .. versionadded:: 2.0.0b3 + + """ + return self._real_result.closed # type: ignore + + @property def t(self) -> AsyncTupleResult[_TP]: """Apply a "typed tuple" typing filter to returned rows. |