diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-19 12:38:14 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2019-05-19 13:58:01 -0400 |
commit | c785a528ea200a8905d1b5d7ab4088d501606d2b (patch) | |
tree | 27bcfe175587c44cb834e38c98f8c539e041ebae /lib/sqlalchemy/orm/attributes.py | |
parent | f07e050c9ce4afdeb9c0c136dbcc547f7e5ac7b8 (diff) | |
download | sqlalchemy-c785a528ea200a8905d1b5d7ab4088d501606d2b.tar.gz |
Add QueryableAttribute._impl_uses_objects accessor for AssociationProxy
Fixed regression where new association proxy system was still not proxying
hybrid attributes when they made use of the ``@hybrid_property.expression``
decorator to return an alternate SQL expression, or when the hybrid
returned an arbitrary :class:`.PropComparator`, at the expression level.
This involved futher generalization of the heuristics used to detect the
type of object being proxied at the level of :class:`.QueryableAttribute`,
to better detect if the descriptor ultimately serves mapped classes or
column expressions.
Fixes: #4690
Change-Id: I5b5300661291c94a23de53bcf92d747701720aa1
Diffstat (limited to 'lib/sqlalchemy/orm/attributes.py')
-rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index f37928cc1..674c57fea 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -104,6 +104,10 @@ class QueryableAttribute( def _supports_population(self): return self.impl.supports_population + @property + def _impl_uses_objects(self): + return self.impl.uses_objects + def get_history(self, instance, passive=PASSIVE_OFF): return self.impl.get_history( instance_state(instance), instance_dict(instance), passive @@ -310,6 +314,13 @@ def create_proxied_attribute(descriptor): _is_internal_proxy = True @property + def _impl_uses_objects(self): + return ( + self.original_property is not None + and getattr(self.class_, self.key).impl.uses_objects + ) + + @property def property(self): return self.comparator.property |