-
assigned issue to
disable multirow eager loaders based on uselist instead of MANYTOONE?
Issue #3249
resolved
why not? this makes it higher risk if someone is using uselist improperly, but if they are doing that then they are getting warnings anyway.
all the tests pass except one that is looking for exact SQL.
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index d95f17f..9549e09 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -1246,7 +1246,7 @@ class JoinedLoader(AbstractRelationshipLoader):
anonymize_labels=True)
assert clauses.aliased_class is not None
- if self.parent_property.direction != interfaces.MANYTOONE:
+ if self.parent_property.uselist:
context.multi_row_eager_loaders = True
innerjoin = (
Comments (2)
-
reporter -
reporter - changed status to resolved
- The subquery wrapping which occurs when joined eager loading
is used with a one-to-many query that also features LIMIT,
OFFSET, or DISTINCT has been disabled in the case of a one-to-one
relationship, that is a one-to-many with
:paramref:
.relationship.uselist
set to False. This will produce more efficient queries in these cases. fixes#3249
→ <<cset 201ba16fc884>>
- Log in to comment