mirror of
https://github.com/sqlalchemy/sqlalchemy.git
synced 2026-07-24 15:21:12 -04:00
7fb3ef3e2d
The behavior of :func:`_orm.with_polymorphic` when used with a single inheritance mapping has been changed such that its behavior should match as closely as possible to that of an equivalent joined inheritance mapping. Specifically this means that the base class specified in the :func:`_orm.with_polymorphic` construct will be the basemost class that is loaded, as well as all descendant classes of that basemost class. The change includes that the descendant classes named will no longer be exclusively indicated in "WHERE polymorphic_col IN" criteria; instead, the whole hierarchy starting with the given basemost class will be loaded. If the query indicates that rows should only be instances of a specific subclass within the polymorphic hierarchy, an error is raised if an incompatible superclass is loaded in the result since it cannot be made to match the requested class; this behavior is the same as what joined inheritance has done for many years. The change also allows a single result set to include column-level results from multiple sibling classes at once which was not previously possible with single table inheritance. Fixes: #12395 Change-Id: I9307b236a6de8c47e452fb8f982098c54edb811a