class AssociationProxyInstance(object):
Known subclasses: sqlalchemy.ext.associationproxy.ColumnAssociationProxyInstance
, sqlalchemy.ext.associationproxy.ObjectAssociationProxyInstance
, sqlalchemy.ext.associationproxy.AmbiguousAssociationProxyInstance
A per-class object that serves class- and object-specific results.
This is used by .AssociationProxy
when it is invoked
in terms of a specific class or instance of a class, i.e. when it is
used as a regular Python descriptor.
When referring to the .AssociationProxy
as a normal Python
descriptor, the .AssociationProxyInstance
is the object that
actually serves the information. Under normal circumstances, its presence
is transparent:
>>> User.keywords.scalar False
In the special case that the .AssociationProxy
object is being
accessed directly, in order to get an explicit handle to the
.AssociationProxyInstance
, use the
.AssociationProxy.for_class
method:
proxy_state = inspect(User).all_orm_descriptors["keywords"].for_class(User) # view if proxy object is scalar or not >>> proxy_state.scalar False
Class Method | for_proxy |
Undocumented |
Method | any |
Produce a proxied 'any' expression using EXISTS. |
Method | delete |
Undocumented |
Method | get |
Undocumented |
Method | has |
Produce a proxied 'has' expression using EXISTS. |
Method | set |
Undocumented |
Instance Variable | target_class |
The intermediary class handled by this .AssociationProxyInstance . |
Class Method | _cls_unwrap_target_assoc_proxy |
Undocumented |
Class Method | _construct_for_assoc |
Undocumented |
Method | __clause_element__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | _criterion_exists |
Undocumented |
Method | _default_getset |
Undocumented |
Method | _get_property |
Undocumented |
Method | _inflate |
Undocumented |
Method | _initialize_scalar_accessors |
Undocumented |
Method | _new |
Undocumented |
Method | _set |
Undocumented |
Instance Variable | _scalar_get |
Undocumented |
Instance Variable | _scalar_set |
Undocumented |
Instance Variable | collection_class |
Undocumented |
Instance Variable | key |
Undocumented |
Instance Variable | owning_class |
Undocumented |
Instance Variable | parent |
Undocumented |
Instance Variable | target_collection |
Undocumented |
Instance Variable | value_attr |
Undocumented |
Property | _comparator |
Undocumented |
Property | _target_is_object |
Undocumented |
Property | _unwrap_target_assoc_proxy |
Undocumented |
Property | _value_is_scalar |
Undocumented |
Property | attr |
Return a tuple of (local_attr, remote_attr). |
Property | info |
Undocumented |
Property | local_attr |
The 'local' class attribute referenced by this .AssociationProxyInstance . |
Property | remote_attr |
The 'remote' class attribute referenced by this .AssociationProxyInstance . |
Property | scalar |
Return True if this .AssociationProxyInstance proxies a scalar relationship on the local side. |
Produce a proxied 'any' expression using EXISTS.
This expression will be a composed product
using the .RelationshipProperty.Comparator.any
and/or .RelationshipProperty.Comparator.has
operators of the underlying proxied attributes.
Produce a proxied 'has' expression using EXISTS.
This expression will be a composed product
using the .RelationshipProperty.Comparator.any
and/or .RelationshipProperty.Comparator.has
operators of the underlying proxied attributes.
The intermediary class handled by this
.AssociationProxyInstance
.
Intercepted append/set/assignment events will result in the generation of new instances of this class.
Undocumented
Return a tuple of (local_attr, remote_attr).
This attribute was originally intended to facilitate using the
_query.Query.join
method to join across the two relationships
at once, however this makes use of a deprecated calling style.
To use _sql.select.join
or _orm.Query.join
with
an association proxy, the current method is to make use of the
.AssociationProxyInstance.local_attr
and
.AssociationProxyInstance.remote_attr
attributes separately:
stmt = ( select(Parent). join(Parent.proxied.local_attr). join(Parent.proxied.remote_attr) )
A future release may seek to provide a more succinct join pattern for association proxy attributes.
See Also
.AssociationProxyInstance.local_attr
.AssociationProxyInstance.remote_attr
The 'local' class attribute referenced by this
.AssociationProxyInstance
.
See Also
.AssociationProxyInstance.attr
.AssociationProxyInstance.remote_attr
The 'remote' class attribute referenced by this
.AssociationProxyInstance
.
See Also
.AssociationProxyInstance.attr
.AssociationProxyInstance.local_attr