]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
propagate regular execution_options to secondary eager loaders
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 13 Aug 2023 15:16:03 +0000 (11:16 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 14 Aug 2023 19:19:29 +0000 (15:19 -0400)
commitb3785075240ec47139ad39e6ec40d65755bae09c
tree72fccd7c56aa1e1439ce81db8984bad241935734
parent0cf1c669461c841f67d8bfdaea421ce1c82fffdc
propagate regular execution_options to secondary eager loaders

Fixed fairly major issue where execution options passed to
:meth:`_orm.Session.execute`, as well as execution options local to the ORM
executed statement itself, would not be propagated along to eager loaders
such as that of :func:`_orm.selectinload`, :func:`_orm.immediateload`, and
:meth:`_orm.subqueryload`, making it impossible to do things such as
disabling the cache for a single statement or using
``schema_translate_map`` for a single statement, as well as the use of
user-custom execution options.   A change has been made where **all**
user-facing execution options present for :meth:`_orm.Session.execute` will
be propagated along to additional loaders.

As part of this change, the warning for "excessively deep" eager loaders
leading to caching being disabled can be silenced on a per-statement
basis by sending ``execution_options={"compiled_cache": None}`` to
:meth:`_orm.Session.execute`, which will disable caching for the full
series of statements within that scope.

Fixes: #10231
Change-Id: I5304d3af0b78e1b4593c3558f117b7ac10b499ae
doc/build/changelog/unreleased_20/10231.rst [new file with mode: 0644]
lib/sqlalchemy/orm/bulk_persistence.py
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/strategies.py
test/orm/dml/test_update_delete_where.py
test/orm/test_recursive_loaders.py
test/orm/test_session.py