From 741af02893a19c879ba4d929151b9358aeb48148 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 30 Jun 2022 19:10:06 -0400 Subject: repair yield_per for non-SS dialects and add new options Implemented new :paramref:`_engine.Connection.execution_options.yield_per` execution option for :class:`_engine.Connection` in Core, to mirror that of the same :ref:`yield_per ` option available in the ORM. The option sets both the :paramref:`_engine.Connection.execution_options.stream_results` option at the same time as invoking :meth:`_engine.Result.yield_per`, to provide the most common streaming result configuration which also mirrors that of the ORM use case in its usage pattern. Fixed bug in :class:`_engine.Result` where the usage of a buffered result strategy would not be used if the dialect in use did not support an explicit "server side cursor" setting, when using :paramref:`_engine.Connection.execution_options.stream_results`. This is in error as DBAPIs such as that of SQLite and Oracle already use a non-buffered result fetching scheme, which still benefits from usage of partial result fetching. The "buffered" strategy is now used in all cases where :paramref:`_engine.Connection.execution_options.stream_results` is set. Added :meth:`.FilterResult.yield_per` so that result implementations such as :class:`.MappingResult`, :class:`.ScalarResult` and :class:`.AsyncResult` have access to this method. Fixes: #8199 Change-Id: I6dde3cbe483a1bf81e945561b60f4b7d1c434750 --- lib/sqlalchemy/ext/asyncio/result.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/sqlalchemy/ext/asyncio') diff --git a/lib/sqlalchemy/ext/asyncio/result.py b/lib/sqlalchemy/ext/asyncio/result.py index 8a1b1be32..43f5fae81 100644 --- a/lib/sqlalchemy/ext/asyncio/result.py +++ b/lib/sqlalchemy/ext/asyncio/result.py @@ -27,6 +27,7 @@ from ...engine.result import MergedResult from ...engine.result import ResultMetaData from ...engine.row import Row from ...engine.row import RowMapping +from ...sql.base import _generative from ...util.concurrency import greenlet_spawn from ...util.typing import Literal @@ -138,6 +139,7 @@ class AsyncResult(AsyncCommon[Row[_TP]]): """ return self._metadata.keys + @_generative def unique( self: SelfAsyncResult, strategy: Optional[_UniqueFilterType] = None ) -> SelfAsyncResult: -- cgit v1.2.1