summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorFederico Caselli <cfederico87@gmail.com>2023-02-03 19:38:55 +0000
committerGerrit Code Review <gerrit@bbpush.zzzcomputing.com>2023-02-03 19:38:55 +0000
commit2c38e0262108bcbab341c30c9aabb5e06c9ae877 (patch)
treecc4e16042e71cf4680fe2001f4a8a5d2787e67c3 /lib/sqlalchemy
parent056d7815f0a605b3a1176121922d0b78ce0d23f8 (diff)
parentd995af71980b1f887f2f374580d1341d72cc3442 (diff)
downloadsqlalchemy-2c38e0262108bcbab341c30c9aabb5e06c9ae877.tar.gz
Merge "Fixed regression when using from_statement in orm context." into main
Diffstat (limited to 'lib/sqlalchemy')
-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