class documentation

Defines a "composite" mapped attribute, representing a collection of columns as one attribute. :class:`.CompositeProperty` is constructed using the :func:`.composite` function. .. seealso:: :ref:`mapper_composite`

Class Comparator Produce boolean, comparison, and other operators for :class:`.Composite` attributes.
Class CompositeBundle Undocumented
Method __init__ Undocumented
Method __str__ Undocumented
Method declarative_scan Perform class-specific initializaton at early declarative scanning time.
Method do_init Initialization which occurs after the :class:`.Composite` has been associated with its parent mapper.
Method get_history Provided for userland code that uses attributes.get_history().
Method instrument_class Hook called by the Mapper to the property to initiate instrumentation of the class attribute managed by this MapperProperty.
Instance Variable active_history Undocumented
Instance Variable attrs Undocumented
Instance Variable comparator_factory Undocumented
Instance Variable composite_class Undocumented
Instance Variable deferred Undocumented
Instance Variable descriptor Undocumented
Instance Variable group Undocumented
Property columns Undocumented
Property columns_to_assign A list of Column objects that should be declaratively added to the new Table object.
Property mapper_property_to_assign return a MapperProperty to be assigned to the declarative mapping
Property props Undocumented
Method _comparator_factory Undocumented
Method _composite_values_from_instance Undocumented
Method _create_descriptor Create the Python descriptor that will serve as the access point on instances of the mapped class.
Method _init_accessor Undocumented
Method _populate_composite_bulk_save_mappings_fn Undocumented
Method _setup_arguments_on_columns Propagate configuration arguments made on this composite to the target columns, for those that apply.
Method _setup_event_handlers Establish events that populate/expire the composite attribute.
Method _setup_for_dataclass Undocumented
Constant _COMPOSITE_FGET Undocumented
Instance Variable _generated_composite_accessor Undocumented
Property _attribute_keys Undocumented
Property _comparable_elements Undocumented

Inherited from _MapsColumns:

Class Variable __slots__ Undocumented

Inherited from _IntrospectsAnnotations (via _MapsColumns):

Method found_in_pep593_annotated return a copy of this object to use in declarative when the object is found inside of an Annotated object.
Method _raise_for_required Undocumented

Inherited from DescriptorProperty (via _MapsColumns, _IntrospectsAnnotations):

Class Variable doc optional documentation string
Class Variable uses_objects Undocumented
Class Variable _links_to_entity True if this MapperProperty refers to a mapped entity.

Inherited from MapperProperty (via _MapsColumns, _IntrospectsAnnotations, DescriptorProperty):

Method __repr__ Undocumented
Method cascade_iterator Iterate through instances related to the given instance for a particular 'cascade', starting with this MapperProperty.
Method create_row_processor Produce row processing functions and append to the given set of populators lists.
Method init Called after all mappers are created to assemble relationships between mappers and perform other post-mapper-creation initialization steps.
Method merge Merge the attribute represented by this ``MapperProperty`` from source to destination object.
Method post_instrument_class Perform instrumentation adjustments that need to occur after init() has completed.
Method set_parent Set the parent mapper that references this MapperProperty.
Method setup Called by Query for the purposes of constructing a SQL statement.
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 info Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`.
Class Variable is_property 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_attribute Return the class-bound descriptor corresponding to this :class:`.MapperProperty`.
Method _memoized_attr_info Info dictionary associated with the object, allowing user-defined data to be associated with this :class:`.InspectionAttr`.
Class Variable _cache_key_traversal Undocumented
Class Variable _is_relationship Undocumented
Instance Variable _attribute_options behavioral options for ORM-enabled Python attributes
Instance Variable _configure_finished Undocumented
Instance Variable _configure_started Undocumented
Instance Variable _has_dataclass_arguments Undocumented

Inherited from HasCacheKey (via _MapsColumns, _IntrospectsAnnotations, DescriptorProperty, MapperProperty):

Class Variable inherit_cache Indicate if this :class:`.HasCacheKey` instance should make use of the cache key generation scheme used by its immediate superclass.
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 _generated_cache_key_traversal Undocumented
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 TypingOnly (via _MapsColumns, _IntrospectsAnnotations, DescriptorProperty, MapperProperty, HasCacheKey, _DCAttributeOptions, _MappedAttribute):

Method __init_subclass__ Undocumented

Inherited from InspectionAttr (via _MapsColumns, _IntrospectsAnnotations, DescriptorProperty, MapperProperty, HasCacheKey, _DCAttributeOptions, _MappedAttribute, TypingOnly, InspectionAttrInfo):

Class Variable is_aliased_class True if this object is an instance of :class:`.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 :class:`.Bundle`.
Class Variable is_clause_element True if this object is an instance of :class:`_expression.ClauseElement`.
Class Variable is_instance True if this object is an instance of :class:`.InstanceState`.
Class Variable is_mapper True if this object is an instance of :class:`_orm.Mapper`.
Class Variable is_selectable Return True if this object is an instance of :class:`_expression.Selectable`.
Class Variable _is_internal_proxy True if this object is an internal proxy object.

Inherited from MemoizedSlots (via _MapsColumns, _IntrospectsAnnotations, DescriptorProperty, MapperProperty, HasCacheKey, _DCAttributeOptions, _MappedAttribute, TypingOnly, InspectionAttrInfo, InspectionAttr):

Method __getattr__ Undocumented
Method _fallback_getattr Undocumented
def __init__(self, _class_or_attr: Union[None, Type[_CC], Callable[..., _CC], _CompositeAttrType[Any]] = None, *attrs: _CompositeAttrType[Any], attribute_options: Optional[_AttributeOptions] = None, active_history: bool = False, deferred: bool = False, group: Optional[str] = None, comparator_factory: Optional[Type[Comparator[_CC]]] = None, info: Optional[_InfoType] = None, **kwargs: Any): (source)
def __str__(self) -> str: (source)

Undocumented

@util.preload_module('sqlalchemy.orm.properties')
def declarative_scan(self, decl_scan: _ClassScanMapperConfig, registry: _RegistryType, cls: Type[Any], originating_module: Optional[str], key: str, mapped_container: Optional[Type[Mapped[Any]]], annotation: Optional[_AnnotationScanType], extracted_mapped_annotation: Optional[_AnnotationScanType], is_dataclass_field: bool): (source)

Perform class-specific initializaton at early declarative scanning time. .. versionadded:: 2.0

def do_init(self): (source)

Initialization which occurs after the :class:`.Composite` has been associated with its parent mapper.

def get_history(self, state: InstanceState[Any], dict_: _InstanceDict, passive: PassiveFlag = PassiveFlag.PASSIVE_OFF) -> History: (source)

Provided for userland code that uses attributes.get_history().

def instrument_class(self, mapper: Mapper[Any]): (source)

Hook called by the Mapper to the property to initiate instrumentation of the class attribute managed by this MapperProperty. The MapperProperty here will typically call out to the attributes module to set up an InstrumentedAttribute. This step is the first of two steps to set up an InstrumentedAttribute, and is called early in the mapper setup process. The second step is typically the init_class_attribute step, called from StrategizedProperty via the post_instrument_class() hook. This step assigns additional state to the InstrumentedAttribute (specifically the "impl") which has been determined after the MapperProperty has determined what kind of persistence management it needs to do (e.g. scalar, object, collection, etc).

active_history = (source)

Undocumented

Undocumented

comparator_factory = (source)

Undocumented

composite_class = (source)

Undocumented

deferred = (source)

Undocumented

Undocumented

@util.non_memoized_property
@util.preload_module('orm.properties')
columns: Sequence[Column[Any]] = (source)

Undocumented

A list of Column objects that should be declaratively added to the new Table object.

@property
mapper_property_to_assign: Optional[MapperProperty[_CC]] = (source)

return a MapperProperty to be assigned to the declarative mapping

@util.memoized_property
@util.preload_module('orm.properties')
props: Sequence[MapperProperty[Any]] = (source)

Undocumented

def _comparator_factory(self, mapper: Mapper[Any]) -> Composite.Comparator[_CC]: (source)

Undocumented

def _composite_values_from_instance(self, value: _CC) -> Tuple[Any, ...]: (source)

Undocumented

def _create_descriptor(self): (source)

Create the Python descriptor that will serve as the access point on instances of the mapped class.

def _init_accessor(self): (source)

Undocumented

def _populate_composite_bulk_save_mappings_fn(self) -> Callable[[Dict[str, Any]], None]: (source)

Undocumented

@util.preload_module('orm.properties')
def _setup_arguments_on_columns(self): (source)

Propagate configuration arguments made on this composite to the target columns, for those that apply.

def _setup_event_handlers(self): (source)

Establish events that populate/expire the composite attribute.

@util.preload_module('sqlalchemy.orm.properties')
@util.preload_module('sqlalchemy.orm.decl_base')
def _setup_for_dataclass(self, registry: _RegistryType, cls: Type[Any], originating_module: Optional[str], key: str): (source)

Undocumented

_COMPOSITE_FGET = (source)

Undocumented

Value
object()
_generated_composite_accessor = (source)

Undocumented

@util.memoized_property
_attribute_keys: Sequence[str] = (source)

Undocumented

@util.memoized_property
_comparable_elements: Sequence[QueryableAttribute[Any]] = (source)

Undocumented