]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
memoize current options and joins w with_entities/with_only_cols
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 15 Jun 2021 19:13:34 +0000 (15:13 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 17 Jun 2021 13:48:52 +0000 (09:48 -0400)
commit5b3e887f46afdbee312d5efd2a14f7c9b7eeac65
tree7c12dd2686dc3d26222383d39527b24613e49da3
parent29fbbd9cebf5d4a4f21d01a74bcfb6dce923fe1b
memoize current options and joins w with_entities/with_only_cols

Fixed further regressions in the same area as that of :ticket:`6052` where
loader options as well as invocations of methods like
:meth:`_orm.Query.join` would fail if the left side of the statement for
which the option/join depends upon were replaced by using the
:meth:`_orm.Query.with_entities` method, or when using 2.0 style queries
when using the :meth:`_sql.Select.with_only_columns` method. A new set of
state has been added to the objects which tracks the "left" entities that
the options / join were made against which is memoized when the lead
entities are changed.

Fixes: #6503
Fixes: #6253
Change-Id: I211b2af98b0b20d1263fb15dc513884dcc5de6a4
16 files changed:
doc/build/changelog/unreleased_14/6503.rst [new file with mode: 0644]
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/query.py
lib/sqlalchemy/orm/strategy_options.py
lib/sqlalchemy/sql/elements.py
lib/sqlalchemy/sql/selectable.py
lib/sqlalchemy/sql/traversals.py
lib/sqlalchemy/sql/visitors.py
test/orm/test_cache_key.py
test/orm/test_joins.py
test/orm/test_options.py
test/profiles.txt
test/sql/test_compare.py
test/sql/test_external_traversal.py
test/sql/test_select.py