class documentation

class StrategizedProperty(MapperProperty):

Known subclasses: sqlalchemy.orm.properties.ColumnProperty, sqlalchemy.orm.properties.RelationshipProperty

View In Hierarchy

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​_for Undocumented
Class Method ​_strategy​_lookup Undocumented
Method ​_get​_context​_loader Undocumented
Method ​_get​_strategy Undocumented
Method ​_memoized​_attr​_​_default​_path​_loader​_key Undocumented
Method ​_memoized​_attr​_​_wildcard​_token Undocumented
Method create​_row​_processor Produce row processing functions and append to the given set of populators lists.
Method do​_init Perform subclass-specific initialization post-mapper-creation steps.
Method post​_instrument​_class 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 ​_all​_strategies Undocumented
Class Variable inherit​_cache Indicate if this .HasCacheKey instance should make use of the cache key generation scheme used by its immediate superclass.
Class Variable strategy​_wildcard​_key Undocumented
Instance Variable ​_strategies Undocumented
Instance Variable strategy Undocumented

Inherited from MapperProperty:

Method __init__ Undocumented
Method __repr__ Undocumented
Method ​_memoized​_attr​_info Info dictionary associated with the object, allowing user-defined data to be associated with this .InspectionAttr.
Method cascade​_iterator 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​_class 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​_parent Set the parent mapper that references this MapperProperty.
Class Variable ​_cache​_key​_traversal Undocumented
Class Variable cascade The set of 'cascade' attribute names.
Class Variable is​_property Part of the InspectionAttr interface; states this object is a mapper property.
Instance Variable ​_configure​_finished Undocumented
Instance Variable ​_configure​_started Undocumented
Instance Variable parent Undocumented
Property ​_links​_to​_entity True if this MapperProperty refers to a mapped entity.
Property class​_attribute Return the class-bound descriptor corresponding to this .MapperProperty.

Inherited from HasCacheKey (via MapperProperty):

Class Method ​_generate​_cache​_attrs generate cache key dispatcher for a new class.
Class Method ​_generate​_cache​_key​_for​_object Undocumented
Method ​_gen​_cache​_key return an optional cache key.
Method ​_generate​_cache​_key return a cache key.
Class Variable ​_hierarchy​_supports​_caching 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​_has​_cache​_key Undocumented

Inherited from InspectionAttr (via MapperProperty):

Class Variable ​_is​_internal​_proxy True if this object is an internal proxy object.
Class Variable is​_aliased​_class True if this object is an instance of .AliasedClass.
Class Variable is​_attribute True if this object is a Python :term:`descriptor`.
Class Variable is​_bundle True if this object is an instance of .Bundle.
Class Variable is​_clause​_element True if this object is an instance of _expression.ClauseElement.
Class Variable is​_instance True if this object is an instance of .InstanceState.
Class Variable is​_mapper True if this object is an instance of _orm.Mapper.
Class Variable is​_selectable Return True if this object is an instance of _expression.Selectable.

Inherited from MemoizedSlots (via MapperProperty):

Method __getattr__ Undocumented
Method ​_fallback​_getattr Undocumented
@classmethod
def strategy_for(cls, **kw):

Undocumented

@classmethod
def _strategy_lookup(cls, requesting_property, *key):

Undocumented

def _get_context_loader(self, context, path):

Undocumented

def _get_strategy(self, key):

Undocumented

def _memoized_attr__default_path_loader_key(self):

Undocumented

def _memoized_attr__wildcard_token(self):

Undocumented

def create_row_processor(self, context, query_entity, path, mapper, result, adapter, populators):
Produce row processing functions and append to the given set of populators lists.
def do_init(self):

Perform subclass-specific initialization post-mapper-creation steps.

This is a template method called by the MapperProperty object's init() method.

def post_instrument_class(self, mapper):

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.

def setup(self, context, query_entity, path, adapter, **kwargs):

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.

__slots__: tuple[str, ...] =
_all_strategies =

Undocumented

inherit_cache: bool =

Indicate if this .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.

See Also

:ref:`compilerext_caching` - General guideslines for setting the .HasCacheKey.inherit_cache attribute for third-party or user defined SQL constructs.

_strategies: dict =

Undocumented

strategy =

Undocumented