]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Improve support for with_polymorphic in mapper options
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 27 Jan 2019 00:49:44 +0000 (19:49 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Feb 2019 15:37:45 +0000 (10:37 -0500)
commit95c371f1d3007071a32fad1d67329e6f9d56931b
tree8f8d1ef868dbf1b623bbd1d4ad9f25db5d65a8c4
parent7e48d8b2a70b399ffa6ec874f824d6cee82980a0
Improve support for with_polymorphic in mapper options

Improved the behavior of :func:`.orm.with_polymorphic` in conjunction with
loader options, in particular wildcard operations as well as
:func:`.orm.load_only`.  The polymorphic object will be more accurately
targeted so that column-level options on the entity will correctly take
effect.The issue is a continuation of the same kinds of things fixed in
:ticket:`4468`.

The path logic when using chained mapper options is improved
to be more accurate in terms of the entities being linked
in the path; when using :func:`.with_polymorphic`, mapper
options against this entity need to specify attributes
in terms of the with_polymorphic() object and not against the
base mappings.  New error conditions are raised which were previously
more than likely silenty failures.

Fixes: #4469
Change-Id: Ie8d802879663b4ff6f6ac1438c885c06d78ae2a0
doc/build/changelog/unreleased_13/4469.rst [new file with mode: 0644]
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/strategy_options.py
lib/sqlalchemy/orm/util.py
test/aaa_profiling/test_memusage.py
test/orm/inheritance/test_relationship.py
test/orm/test_deferred.py
test/orm/test_options.py