]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Apply nested for joined eager m2o w/ GROUP BY, DISTINCT
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 21 Sep 2025 14:59:51 +0000 (10:59 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 21 Sep 2025 15:01:46 +0000 (11:01 -0400)
commitba8efc59445b41dc6a28ffb1f8b5dace57be8c33
tree3621ca5c878dfd62c977d168a9f990df5213d347
parent1239df35974c229f7c6e76edbc70431a8b1698b4
Apply nested for joined eager m2o w/ GROUP BY, DISTINCT

Fixed issue where joined eager loading would fail to use the "nested" form
of the query when GROUP BY or DISTINCT were present if the eager joins
being added were many-to-ones, leading to additional columns in the columns
clause which would then cause errors.  The check for "nested" is tuned to
be enabled for these queries even for many-to-one joined eager loaders, and
the "only do nested if it's one to many" aspect is now localized to when
the query only has LIMIT or OFFSET added.

Fixes: #11226
Change-Id: I0b4b71cacfe1c6a25d0924e0954ceced1e399ca1
doc/build/changelog/unreleased_21/11226.rst [new file with mode: 0644]
lib/sqlalchemy/orm/context.py
lib/sqlalchemy/orm/strategies.py
test/orm/test_eager_relations.py