summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/context.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r--lib/sqlalchemy/orm/context.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py
index 890f3382b..0e631e66f 100644
--- a/lib/sqlalchemy/orm/context.py
+++ b/lib/sqlalchemy/orm/context.py
@@ -731,19 +731,13 @@ class ORMFromStatementCompileState(ORMCompileState):
# those columns completely, don't interfere with the compiler
# at all; just in ORM land, use an adapter to convert from
# our ORM columns to whatever columns are in the statement,
- # before we look in the result row. If the inner statement is
- # not ORM enabled, assume looser col matching based on name
- statement_is_orm = (
- self.statement._propagate_attrs.get(
- "compile_state_plugin", None
- )
- == "orm"
- )
+ # before we look in the result row. Always adapt on names
+ # to accept cases such as issue #9217.
self._from_obj_alias = ORMStatementAdapter(
_TraceAdaptRole.ADAPT_FROM_STATEMENT,
self.statement,
- adapt_on_names=not statement_is_orm,
+ adapt_on_names=True,
)
return self