An asyncio wrapper around a :class:`_result.Result` object. The :class:`_asyncio.AsyncResult` only applies to statement executions that use a server-side cursor. It is returned only from the :meth:`_asyncio.AsyncConnection.stream` and :meth:`_asyncio.AsyncSession.stream` methods.
| 68 | |
| 69 | |
| 70 | class AsyncResult(_WithKeys, AsyncCommon[Row[Unpack[_Ts]]]): |
| 71 | """An asyncio wrapper around a :class:`_result.Result` object. |
| 72 | |
| 73 | The :class:`_asyncio.AsyncResult` only applies to statement executions that |
| 74 | use a server-side cursor. It is returned only from the |
| 75 | :meth:`_asyncio.AsyncConnection.stream` and |
| 76 | :meth:`_asyncio.AsyncSession.stream` methods. |
| 77 | |
| 78 | .. note:: As is the case with :class:`_engine.Result`, this object is |
| 79 | used for ORM results returned by :meth:`_asyncio.AsyncSession.execute`, |
| 80 | which can yield instances of ORM mapped objects either individually or |
| 81 | within tuple-like rows. Note that these result objects do not |
| 82 | deduplicate instances or rows automatically as is the case with the |
| 83 | legacy :class:`_orm.Query` object. For in-Python de-duplication of |
| 84 | instances or rows, use the :meth:`_asyncio.AsyncResult.unique` modifier |
| 85 | method. |
| 86 | |
| 87 | .. versionadded:: 1.4 |
| 88 | |
| 89 | """ |
| 90 | |
| 91 | __slots__ = () |
| 92 | |
| 93 | _real_result: Result[Unpack[_Ts]] |
| 94 | |
| 95 | def __init__(self, real_result: Result[Unpack[_Ts]]): |
| 96 | self._real_result = real_result |
| 97 | |
| 98 | self._metadata = real_result._metadata |
| 99 | self._unique_filter_state = real_result._unique_filter_state |
| 100 | self._source_supports_scalars = real_result._source_supports_scalars |
| 101 | self._post_creational_filter = None |
| 102 | |
| 103 | # BaseCursorResult pre-generates the "_row_getter". Use that |
| 104 | # if available rather than building a second one |
| 105 | if "_row_getter" in real_result.__dict__: |
| 106 | self._set_memoized_attribute( |
| 107 | "_row_getter", real_result.__dict__["_row_getter"] |
| 108 | ) |
| 109 | |
| 110 | @property |
| 111 | @deprecated( |
| 112 | "2.1.0", |
| 113 | "The :attr:`.AsyncResult.t` attribute is deprecated, :class:`.Row` " |
| 114 | "now behaves like a tuple and can unpack types directly.", |
| 115 | ) |
| 116 | def t(self) -> AsyncTupleResult[Tuple[Unpack[_Ts]]]: |
| 117 | """Apply a "typed tuple" typing filter to returned rows. |
| 118 | |
| 119 | The :attr:`_asyncio.AsyncResult.t` attribute is a synonym for |
| 120 | calling the :meth:`_asyncio.AsyncResult.tuples` method. |
| 121 | |
| 122 | .. versionadded:: 2.0 |
| 123 | |
| 124 | .. seealso:: |
| 125 | |
| 126 | :ref:`change_10635` - describes a migration path from this |
| 127 | workaround for SQLAlchemy 2.1. |