Contain the AssociationProxy class.
The AssociationProxy is a Python property object which provides transparent proxied access to the endpoint of an association object.
See the example examples/association/proxied_association.py.
Class | AssociationProxy |
A descriptor that presents a read/write view of an object attribute. |
Class | AssociationProxyInstance |
A per-class object that serves class- and object-specific results. |
Class | ColumnAssociationProxyInstance |
an .AssociationProxyInstance that has a database column as a target. |
Class | ObjectAssociationProxyInstance |
an .AssociationProxyInstance that has an object as a target. |
Function | association_proxy |
Return a Python property implementing a view of a target attribute which references an attribute on members of the target. |
Constant | ASSOCIATION_PROXY |
Symbol indicating an .InspectionAttr that's of type .AssociationProxy . |
Class | _AssociationCollection |
No class docstring; 0/5 instance variable, 0/1 class variable, 1/6 method documented |
Class | _AssociationDict |
Generic, converting, dict-to-dict proxy. |
Class | _AssociationList |
Generic, converting, list-to-list proxy. |
Class | _AssociationSet |
Generic, converting, set-to-set proxy. |
Class | _lazy_collection |
Undocumented |
Class | AmbiguousAssociationProxyInstance |
an .AssociationProxyInstance where we cannot determine the type of target object. |
Variable | _NotProvided |
Undocumented |
Return a Python property implementing a view of a target attribute which references an attribute on members of the target.
The returned value is an instance of .AssociationProxy
.
Implements a Python property representing a relationship as a collection of simpler values, or a scalar value. The proxied property will mimic the collection type of the target (list, dict or set), or, in the case of a one to one relationship, a simple scalar value.
Parameters | |
target_collection | Name of the attribute we'll proxy to.
This attribute is typically mapped by
~sqlalchemy.orm.relationship to link to a target collection, but
can also be a many-to-one or non-scalar relationship. |
attr | Attribute on the associated instance or instances we'll proxy for. For example, given a target collection of [obj1, obj2], a list created by this proxy property would look like [getattr(obj1, attr), getattr(obj2, attr)] If the relationship is one-to-one or otherwise uselist=False, then simply: getattr(obj, attr) |
**kw | Passes along any other keyword arguments to
.AssociationProxy . |
creator | optional. When new items are added to this proxied collection, new instances of the class collected by the target collection will be created. For list and set collections, the target class constructor will be called with the 'value' for the new instance. For dict types, two arguments are passed: key and value. If you want to construct instances differently, supply a creator function that takes arguments as above and returns instances. For scalar relationships, creator() will be called if the target is None. If the target is present, set operations are proxied to setattr() on the associated object. If you have an associated object with multiple attributes, you may set up multiple association proxies mapping to different attributes. See the unit tests for examples, and for examples of how creator() functions can be used to construct the scalar relationship on-demand in this situation. |
.InspectionAttr
that's.AssociationProxy
.Is assigned to the .InspectionAttr.extension_type
attribute.
Value |
|