class AssociationProxy(interfaces.InspectionAttrInfo, ORMDescriptor[
A descriptor that presents a read/write view of an object attribute.
Method | __delete__ |
Undocumented |
Method | __get__ |
Undocumented |
Method | __init__ |
Construct a new :class:`.AssociationProxy`. |
Method | __repr__ |
Undocumented |
Method | __set__ |
Undocumented |
Method | for |
Return the internal state local to a specific mapped class. |
Class Variable | is |
True if this object is a Python :term:`descriptor`. |
Instance Variable | cascade |
Undocumented |
Instance Variable | creator |
Undocumented |
Instance Variable | getset |
Undocumented |
Instance Variable | info |
Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`. |
Instance Variable | key |
Undocumented |
Instance Variable | proxy |
Undocumented |
Instance Variable | proxy |
Undocumented |
Instance Variable | target |
Undocumented |
Instance Variable | value |
Undocumented |
Method | _as |
Undocumented |
Method | _calc |
Undocumented |
Method | _default |
Undocumented |
Instance Variable | _attribute |
behavioral options for ORM-enabled Python attributes |
Instance Variable | _has |
Undocumented |
Inherited from InspectionAttrInfo
:
Class Variable | __slots__ |
Undocumented |
Inherited from InspectionAttr
(via InspectionAttrInfo
):
Class Variable | is |
True if this object is an instance of :class:`.AliasedClass`. |
Class Variable | is |
True if this object is an instance of :class:`.Bundle`. |
Class Variable | is |
True if this object is an instance of :class:`_expression.ClauseElement`. |
Class Variable | is |
True if this object is an instance of :class:`.InstanceState`. |
Class Variable | is |
True if this object is an instance of :class:`_orm.Mapper`. |
Class Variable | is |
True if this object is an instance of :class:`.MapperProperty`. |
Class Variable | is |
Return True if this object is an instance of :class:`_expression.Selectable`. |
Class Variable | _is |
True if this object is an internal proxy object. |
str
, attr: str
, *, creator: Optional[ _CreatorProtocol]
= None, getset_factory: Optional[ _GetSetFactoryProtocol]
= None, proxy_factory: Optional[ _ProxyFactoryProtocol]
= None, proxy_bulk_set: Optional[ _ProxyBulkSetProtocol]
= None, info: Optional[ _InfoType]
= None, cascade_scalar_deletes: bool
= False, attribute_options: Optional[ _AttributeOptions]
= None):
(source)
¶
Construct a new :class:`.AssociationProxy`. The :class:`.AssociationProxy` object is typically constructed using the :func:`.association_proxy` constructor function. See the description of :func:`.association_proxy` for a description of all parameters.
Type[ Any]
, obj: Optional[ object]
= None) -> AssociationProxyInstance[ _T]
:
(source)
¶
Return the internal state local to a specific mapped class. E.g., given a class ``User``:: class User(Base): # ... keywords = association_proxy('kws', 'keyword') If we access this :class:`.AssociationProxy` from :attr:`_orm.Mapper.all_orm_descriptors`, and we want to view the target class for this proxy as mapped by ``User``:: inspect(User).all_orm_descriptors["keywords"].for_class(User).target_class This returns an instance of :class:`.AssociationProxyInstance` that is specific to the ``User`` class. The :class:`.AssociationProxy` object remains agnostic of its parent class. :param class\_: the class that we are returning state for. :param obj: optional, an instance of the class that is required if the attribute refers to a polymorphic target, e.g. where we have to look at the type of the actual destination object to get the complete path. .. versionadded:: 1.3 - :class:`.AssociationProxy` no longer stores any state specific to a particular parent class; the state is now stored in per-class :class:`.AssociationProxyInstance` objects.
True if this object is a Python :term:`descriptor`. This can refer to one of many types. Usually a :class:`.QueryableAttribute` which handles attributes events on behalf of a :class:`.MapperProperty`. But can also be an extension type such as :class:`.AssociationProxy` or :class:`.hybrid_property`. The :attr:`.InspectionAttr.extension_type` will refer to a constant identifying the specific subtype. .. seealso:: :attr:`_orm.Mapper.all_orm_descriptors`
Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`. The dictionary is generated when first accessed. Alternatively, it can be specified as a constructor argument to the :func:`.column_property`, :func:`_orm.relationship`, or :func:`.composite` functions. .. versionchanged:: 1.0.0 :attr:`.MapperProperty.info` is also available on extension types via the :attr:`.InspectionAttrInfo.info` attribute, so that it can apply to a wider variety of ORM and extension constructs. .. seealso:: :attr:`.QueryableAttribute.info` :attr:`.SchemaItem.info`
Any
) -> Tuple[ _GetterProtocol[ Any], _SetterProtocol]
:
(source)
¶
Undocumented