]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
apply _path_with_polymorphic in prepend as well
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Mar 2026 18:24:10 +0000 (14:24 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Mar 2026 20:55:57 +0000 (16:55 -0400)
commitd3a8d4950e7f1c1cfcabc819e4b85f0bba61e26d
treea4e09554fbac1add9df80e69cb755f8c3208ca5d
parenta49a4f021ad9c9ff69f5482881b00f831d523a22
apply _path_with_polymorphic in prepend as well

Fixed issue where using :meth:`_orm.Load.options` to apply a chained loader
option such as :func:`_orm.joinedload` or :func:`_orm.selectinload` with
:meth:`_orm.PropComparator.of_type` for a polymorphic relationship would
not generate the necessary clauses for the polymorphic subclasses. The
polymorphic loading strategy is now correctly propagated when using a call
such as ``joinedload(A.b).options(joinedload(B.c.of_type(poly)))`` to match
the behavior of direct chaining e.g.
``joinedload(A.b).joinedload(B.c.of_type(poly))``.

Fixes: #13202
Change-Id: I7b2ce2dd10a7f8583ff99495b0a65fa1a895ee29
doc/build/changelog/unreleased_20/13202.rst [new file with mode: 0644]
lib/sqlalchemy/orm/strategy_options.py
test/orm/test_of_type.py