class StrategizedProperty(MapperProperty[
Known subclasses: sqlalchemy.orm.properties.ColumnProperty
, sqlalchemy.orm.properties.RelationshipProperty
A MapperProperty which uses selectable strategies to affect loading behavior. There is a single strategy selected by default. Alternate strategies can be selected at Query time through the usage of ``StrategizedOption`` objects via the Query.options() method. The mechanics of StrategizedProperty are used for every Query invocation for every mapped attribute participating in that Query, to determine first how the attribute will be rendered in SQL and secondly how the attribute will retrieve a value from a result row and apply it to a mapped object. The routines here are very performance-critical.
Class Method | strategy |
Undocumented |
Method | create |
Produce row processing functions and append to the given set of populators lists. |
Method | do |
Perform subclass-specific initialization post-mapper-creation steps. |
Method | post |
Perform instrumentation adjustments that need to occur after init() has completed. |
Method | setup |
Called by Query for the purposes of constructing a SQL statement. |
Class Variable | __slots__ |
Undocumented |
Class Variable | inherit |
Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass. |
Class Variable | strategy |
Undocumented |
Class Variable | strategy |
Undocumented |
Instance Variable | strategy |
Undocumented |
Class Method | _strategy |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _memoized |
Undocumented |
Method | _memoized |
Undocumented |
Class Variable | _all |
Undocumented |
Instance Variable | _strategies |
Undocumented |
Inherited from MapperProperty
:
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | cascade |
Iterate through instances related to the given instance for a particular 'cascade', starting with this MapperProperty. |
Method | init |
Called after all mappers are created to assemble relationships between mappers and perform other post-mapper-creation initialization steps. |
Method | instrument |
Hook called by the Mapper to the property to initiate instrumentation of the class attribute managed by this MapperProperty. |
Method | merge |
Merge the attribute represented by this ``MapperProperty`` from source to destination object. |
Method | set |
Set the parent mapper that references this MapperProperty. |
Class Variable | cascade |
Undocumented |
Class Variable | comparator |
The :class:`_orm.PropComparator` instance that implements SQL expression construction on behalf of this mapped attribute. |
Class Variable | doc |
optional documentation string |
Class Variable | info |
Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`. |
Class Variable | is |
Part of the InspectionAttr interface; states this object is a mapper property. |
Class Variable | key |
name of class attribute |
Instance Variable | parent |
the :class:`.Mapper` managing this property. |
Property | class |
Return the class-bound descriptor corresponding to this :class:`.MapperProperty`. |
Method | _memoized |
Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`. |
Class Variable | _cache |
Undocumented |
Class Variable | _is |
Undocumented |
Class Variable | _links |
True if this MapperProperty refers to a mapped entity. |
Instance Variable | _attribute |
behavioral options for ORM-enabled Python attributes |
Instance Variable | _configure |
Undocumented |
Instance Variable | _configure |
Undocumented |
Instance Variable | _has |
Undocumented |
Inherited from HasCacheKey
(via MapperProperty
):
Class Method | _generate |
generate cache key dispatcher for a new class. |
Class Method | _generate |
Undocumented |
Method | _gen |
return an optional cache key. |
Method | _generate |
return a cache key. |
Class Variable | _generated |
Undocumented |
Class Variable | _hierarchy |
private attribute which may be set to False to prevent the inherit_cache warning from being emitted for a hierarchy of subclasses. |
Class Variable | _is |
Undocumented |
Inherited from TypingOnly
(via MapperProperty
, HasCacheKey
, _DCAttributeOptions
, _MappedAttribute
):
Method | __init |
Undocumented |
Inherited from InspectionAttr
(via MapperProperty
, HasCacheKey
, _DCAttributeOptions
, _MappedAttribute
, TypingOnly
, InspectionAttrInfo
):
Class Variable | is |
True if this object is an instance of :class:`.AliasedClass`. |
Class Variable | is |
True if this object is a Python :term:`descriptor`. |
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 |
Return True if this object is an instance of :class:`_expression.Selectable`. |
Class Variable | _is |
True if this object is an internal proxy object. |
Inherited from MemoizedSlots
(via MapperProperty
, HasCacheKey
, _DCAttributeOptions
, _MappedAttribute
, TypingOnly
, InspectionAttrInfo
, InspectionAttr
):
Method | __getattr__ |
Undocumented |
Method | _fallback |
Undocumented |
ORMCompileState
, query_entity: _MapperEntity
, path: AbstractEntityRegistry
, mapper: Mapper[ Any]
, result: Result[ Any]
, adapter: Optional[ ORMAdapter]
, populators: _PopulatorDict
):
(source)
¶
Produce row processing functions and append to the given set of populators lists.
sqlalchemy.orm.properties.ColumnProperty
, sqlalchemy.orm.properties.RelationshipProperty
Perform subclass-specific initialization post-mapper-creation steps. This is a template method called by the ``MapperProperty`` object's init() method.
Perform instrumentation adjustments that need to occur after init() has completed. The given Mapper is the Mapper invoking the operation, which may not be the same Mapper as self.parent in an inheritance scenario; however, Mapper will always at least be a sub-mapper of self.parent. This method is typically used by StrategizedProperty, which delegates it to LoaderStrategy.init_class_attribute() to perform final setup on the class-bound InstrumentedAttribute.
ORMCompileState
, query_entity: _MapperEntity
, path: AbstractEntityRegistry
, adapter: Optional[ ORMAdapter]
, **kwargs: Any
):
(source)
¶
Called by Query for the purposes of constructing a SQL statement. Each MapperProperty associated with the target mapper processes the statement referenced by the query context, adding columns and/or criterion as appropriate.
sqlalchemy.orm.properties.ColumnProperty
, sqlalchemy.orm.properties.RelationshipProperty
Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass. The attribute defaults to ``None``, which indicates that a construct has not yet taken into account whether or not its appropriate for it to participate in caching; this is functionally equivalent to setting the value to ``False``, except that a warning is also emitted. This flag can be set to ``True`` on a particular class, if the SQL that corresponds to the object does not change based on attributes which are local to this class, and not its superclass. .. seealso:: :ref:`compilerext_caching` - General guideslines for setting the :attr:`.HasCacheKey.inherit_cache` attribute for third-party or user defined SQL constructs.
sqlalchemy.orm.properties.ColumnProperty
, sqlalchemy.orm.properties.RelationshipProperty
Undocumented
def _strategy_lookup(cls, requesting_property:
MapperProperty[ Any]
, *key: Any
) -> Type[ LoaderStrategy]
:
(source)
¶
Undocumented
ORMCompileState
, path: AbstractEntityRegistry
) -> Optional[ _LoadElement]
:
(source)
¶
Undocumented
collections.defaultdict[ Type[ MapperProperty[ Any]], Dict[ _StrategyKey, Type[ LoaderStrategy]]]
=
(source)
¶
Undocumented