]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
repair yield_per for non-SS dialects and add new options
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 30 Jun 2022 23:10:06 +0000 (19:10 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 1 Jul 2022 16:14:58 +0000 (12:14 -0400)
commit06685f392d2e36981b4073b902539ad966c57327
tree454cf6ebccbd8b1ae369b7296effc0c60722d2dc
parent3e98a236008c0d4b7b83e70cfd1365c98dd42528
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 <orm_queryguide_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
(cherry picked from commit e5a0cdb2eaa1d7f381e93d0529a7f8e6d5888877)
15 files changed:
doc/build/changelog/unreleased_14/yp.rst [new file with mode: 0644]
doc/build/core/connections.rst
doc/build/orm/queryguide.rst
lib/sqlalchemy/engine/__init__.py
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/engine/cursor.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/result.py
lib/sqlalchemy/ext/asyncio/result.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/testing/fixtures.py
test/ext/asyncio/test_engine_py3k.py
test/orm/test_query.py
test/sql/test_resultset.py