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/ext/associationproxy.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/ext/associationproxy.py')
| -rw-r--r-- | lib/sqlalchemy/ext/associationproxy.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py index c725372c5..9a8294f3c 100644 --- a/lib/sqlalchemy/ext/associationproxy.py +++ b/lib/sqlalchemy/ext/associationproxy.py @@ -391,15 +391,11 @@ class AssociationProxyInstance(object): ) attr = getattr(target_class, value_attr) - if ( - not hasattr(attr, "_is_internal_proxy") - or attr._is_internal_proxy - and not hasattr(attr, "impl") - ): + if not hasattr(attr, "_is_internal_proxy"): return AmbiguousAssociationProxyInstance( parent, owning_class, target_class, value_attr ) - is_object = attr.impl.uses_objects + is_object = attr._impl_uses_objects if is_object: return ObjectAssociationProxyInstance( parent, owning_class, target_class, value_attr |
