diff options
Diffstat (limited to 'lib/sqlalchemy/orm/context.py')
-rw-r--r-- | lib/sqlalchemy/orm/context.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/context.py b/lib/sqlalchemy/orm/context.py index 6cdad9f41..042acc9c5 100644 --- a/lib/sqlalchemy/orm/context.py +++ b/lib/sqlalchemy/orm/context.py @@ -2691,8 +2691,9 @@ class _ORMColumnEntity(_ColumnEntity): # within internal loaders. orm_key = annotations.get("proxy_key", None) + proxy_owner = annotations.get("proxy_owner", _entity.entity) if orm_key: - self.expr = getattr(_entity.entity, orm_key) + self.expr = getattr(proxy_owner, orm_key) self.translate_raw_column = False else: # if orm_key is not present, that means this is an ad-hoc |