]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Set complete FROM list for subquery eagerload's orig query
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Jun 2017 17:12:16 +0000 (13:12 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 16 Jun 2017 17:02:31 +0000 (13:02 -0400)
commita991eedcf559e6992ada92913a29ed7022d62caa
treecb10f9ad9b518ed7269503b53a637ac8d61b32bb
parent3a314fcea8539133947d5ec8e42a6c86e30fdf9a
Set complete FROM list for subquery eagerload's orig query

Instead of checking that the "orig_entity" we receive applies
as a correct FROM element for the subquery we're building,
set the FROM clause of the query to exactly what it already
is based on column_descriptions (assuming there is no FROM
list already), thereby ensuring that the FROM list will remain
intact, regardless of what orig_entity turns out to be and
what the target_cols ultimately refer towards.

Fixed issue with subquery eagerloading which continues on from
the series of issues fixed in :ticket:`2699`, :ticket:`3106`,
:ticket:`3893` involving that the "subquery" contains the correct
FROM clause when beginning from a joined inheritance subclass
and then subquery eager loading onto a relationship from
the base class, while the query also includes criteria against
the subclass. The fix in the previous tickets did not accommodate
for additional subqueryload operations loading more deeply from
the first level, so the fix has been further generalized.

Change-Id: Ic909590814f71e577d8266b1dbc4c393dc48e019
Fixes: #4011
doc/build/changelog/changelog_11.rst
lib/sqlalchemy/orm/strategies.py
test/orm/inheritance/_poly_fixtures.py
test/orm/test_subquery_relations.py