]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
consider _ClassStrategyLoad as part of endpoint path
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Sep 2023 14:48:03 +0000 (10:48 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 17 Sep 2023 16:34:30 +0000 (12:34 -0400)
commit825172a47de9a02cd2a7aafd8ae1fbccc263a7fd
treedc8b1a0341096604f38ef2dc2d265b5e32cc1d3e
parent7fdaf711dc6bd578f7becf45526dce70f523890d
consider _ClassStrategyLoad as part of endpoint path

Added new capability to the :func:`_orm.selectin_polymorphic` loader option
which allows other loader options to be bundled as siblings, referring to
one of its subclasses, within the sub-options of parent loader option.
Previously, this pattern was only supported if the
:func:`_orm.selectin_polymorphic` were at the top level of the options for
the query.   See new documentation section for example.

As part of this change, improved the behavior of the
:meth:`_orm.Load.selectin_polymorphic` method / loader strategy so that the
subclass load does not load most already-loaded columns from the parent
table, when the option is used against a class that is already being
relationship-loaded.  Previously, the logic to load only the subclass
columns worked only for a top level class load.

Fixes: #10348
Change-Id: I13a8cad5484e97b2ab51402f100193cb054e2155
doc/build/changelog/unreleased_20/10348.rst [new file with mode: 0644]
doc/build/orm/queryguide/inheritance.rst
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/path_registry.py
lib/sqlalchemy/orm/strategy_options.py
lib/sqlalchemy/orm/util.py
test/orm/inheritance/test_poly_loading.py
test/orm/inheritance/test_relationship.py
test/orm/test_options.py