]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Optimize out JOIN for selectinload with many to one
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Jul 2019 17:05:06 +0000 (13:05 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 19 Jul 2019 21:55:42 +0000 (17:55 -0400)
commita5a66f1e580150a55a729e7b6dc804adb55b2f5c
treed17890f8fa110a15bba561ba109eda053e3a9e2a
parent3bc3ea395eb16f548a11849bc15f0f78b7b2400f
Optimize out JOIN for selectinload with many to one

The optimzation applied to selectin loading in :ticket:`4340` where a JOIN
is not needed to eagerly load related items is now applied to many-to-one
relationships as well, so that only the related table is queried for a
simple join condition.   In this case, the related items are queried
based on the value of a foreign key column on the parent; if these columns
are deferred or otherwise not loaded on any of the parent objects in
the collection, the loader falls back to the JOIN method.

Fixes: #4775
Change-Id: I398e0d276789ce6e0019d213a37bdf99d24ec290
doc/build/changelog/unreleased_13/4775.rst [new file with mode: 0644]
doc/build/orm/loading_relationships.rst
lib/sqlalchemy/orm/strategies.py
test/orm/test_selectin_relations.py