summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/context.py
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-09-24 01:00:10 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-09-24 01:00:10 +0000
commit8e59de9cc180453470f2530a459ae8c248916288 (patch)
treeeeedfe458681c58e6e0cdfc40927336ebd766ccb /lib/sqlalchemy/orm/context.py
parentd50bbd56740f86bb363b405f7d8e5df9667bb4e3 (diff)
parent57b400f07951f0ae8651ca38338ec5be1d222c7e (diff)
downloadsqlalchemy-8e59de9cc180453470f2530a459ae8c248916288.tar.gz
Merge "remove should_nest behavior for contains_eager()" into main
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r--lib/sqlalchemy/orm/context.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index ff0cdd680..4f24103df 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -529,6 +529,7 @@ class ORMFromStatementCompileState(ORMCompileState):
_has_orm_entities = False
multi_row_eager_loaders = False
+ eager_adding_joins = False
compound_eager_adapter = None
extra_criteria_entities = _EMPTY_DICT
@@ -794,6 +795,7 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
_has_orm_entities = False
multi_row_eager_loaders = False
+ eager_adding_joins = False
compound_eager_adapter = None
correlate = None
@@ -1106,7 +1108,11 @@ class ORMSelectCompileState(ORMCompileState, SelectState):
if self.order_by is False:
self.order_by = None
- if self.multi_row_eager_loaders and self._should_nest_selectable:
+ if (
+ self.multi_row_eager_loaders
+ and self.eager_adding_joins
+ and self._should_nest_selectable
+ ):
self.statement = self._compound_eager_statement()
else:
self.statement = self._simple_statement()