]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
restore graceful degrade of subqueryload w from_statement
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Dec 2021 16:25:00 +0000 (11:25 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 26 Dec 2021 19:47:14 +0000 (14:47 -0500)
commit5d12593ae142ea8f377916f785b59c33d65046a4
treef8c0cdf32a5fb5f6ed5e7c504e7066bc248378ba
parent6cdb3331c6a3331faf74f134ec0d04c7f217c454
restore graceful degrade of subqueryload w from_statement

Fixed regression from 1.3 where the "subqueryload" loader strategy would
fail with a stack trace if used against a query that made use of
:meth:`_orm.Query.from_statement` or :meth:`_sql.Select.from_statement`. As
subqueryload requires modifying the original statement, it's not compatible
with the "from_statement" use case, especially for statements made against
the :func:`_sql.text` construct. The behavior now is equivalent to that of
1.3 and previously, which is that the loader strategy silently degrades to
not be used for such statements, typically falling back to using the
lazyload strategy.

Fixes: #7505
Change-Id: I950800dc86a77f8320a5e696edce1ff2c84b1eb9
(cherry picked from commit 818d62be00530549aa52dd5d981819010e4ae484)
doc/build/changelog/unreleased_14/7505.rst [new file with mode: 0644]
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_eager_relations.py
test/orm/test_query.py
test/orm/test_selectin_relations.py
test/orm/test_subquery_relations.py