]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
use load_scalar_attributes() for undefer
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 15 Dec 2021 20:00:28 +0000 (15:00 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 19 Dec 2021 18:49:38 +0000 (13:49 -0500)
commit736f93473d351cf3ab7680e4ed373e19f997b3bb
treef29449dc6e8ffb55177d86aaaa241948d1eb413a
parenta91df497d8d78292b0b5e7f79656b3f82d7de4f7
use load_scalar_attributes() for undefer

At some point, undeferral of attributes started emitting
a full ORM query for the entity, including that subclass columns
would use a JOIN.   Seems to be at least in 1.3 / 1.4 and possibly
earlier.    This JOINs to the superclass table unnecessarily.
Use load_scalar_attributes() here which should handle the whole
thing and emits a more efficient query for joined inheritance.

As this behavior seems to have been throughout 1.3 and 1.4
at least, targeting at 2.0 is likely best.

Fixes: #7463
Change-Id: Ie4bae767747bba0d03fb13eaff579d4bab0b1bc2
doc/build/changelog/unreleased_20/7463.rst [new file with mode: 0644]
lib/sqlalchemy/orm/loading.py
lib/sqlalchemy/orm/strategies.py
test/orm/inheritance/test_basic.py
test/orm/inheritance/test_poly_loading.py