]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Limit select in loading for correct types
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 10 Jan 2018 04:03:40 +0000 (23:03 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 12 Jan 2018 17:59:09 +0000 (12:59 -0500)
commita216625bd03313e85f8063c2c875730e15edc4a4
tree96856673e2d31f177b65c52e9132c904638db43f
parent3316890ffa9a51471ca7618e4a13e45494e03198
Limit select in loading for correct types

Fixed bug in new "selectin" relationship loader where the loader could try
to load a non-existent relationship when loading a collection of
polymorphic objects, where only some of the mappers include that
relationship, typically when :meth:`.PropComparator.of_type` is being used.

This generalizes the mapper limiting that was present
in _load_subclass_via_in() to be part of the PostLoad object
itself, and is used by both polymorphic selectin loading and
relationship selectin loading.

Change-Id: I31416550e27bc8374b673860f57d9dcf96abe87d
Fixes: #4156
doc/build/changelog/unreleased_12/4156.rst [new file with mode: 0644]
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_selectin_relations.py