]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Adjust use_mapper_path rule for poly subclasses
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 13 Jan 2020 18:50:38 +0000 (13:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 13 Jan 2020 21:45:38 +0000 (16:45 -0500)
commit7cc2de880b0de2b127a54910761f357f3753c689
tree2884e4bc827de3838f5da2d93eb3642c68954afd
parent295441bab3051e96e7651047acb02cabca9ac0f5
Adjust use_mapper_path rule for poly subclasses

We must change the approach from 2734439 as the information
loss is breaking subquery eager loading.

Move the adjustment into a deeper set of logic inside
of path_regsitry.  We can distinguish between a path
that will "naturally" build from an aliased entity
at the base, vs. one that will "naturally" build
on all raw mappers, based on if when we observe that
we are being given a with_polymorphic(), if the existing
parent path is already in progress or not.

In general, we prefer paths to have as much of the original
information as possible, and the "natural path" is supposed
to be where the loader lookup stuff happens.

Fixes: #5082
Change-Id: I3c0ee72993bae8a6f067bdef3dc9a57d83f64950
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/util.py
test/orm/inheritance/test_polymorphic_rel.py
test/orm/test_utils.py