class documentation

class MutableComposite(MutableBase): (source)

View In Hierarchy

Mixin that defines transparent propagation of change events on a SQLAlchemy "composite" object to its owning parent or parents. See the example in :ref:`mutable_composites` for usage information.

Method changed Subclasses should call this method whenever change events occur.
Class Method _get_listen_keys Given a descriptor attribute, return a ``set()`` of the attribute keys which indicate a change in the state of this attribute.

Inherited from MutableBase:

Class Method coerce Given a value, coerce it into the target type.
Class Method _listen_on_attribute Establish this type as a mutation listener for the given mapped descriptor.
Property _parents Dictionary of parent object's :class:`.InstanceState`->attribute name on the parent.
def changed(self): (source)

Subclasses should call this method whenever change events occur.

@classmethod
def _get_listen_keys(cls, attribute: QueryableAttribute[_O]) -> Set[str]: (source)

Given a descriptor attribute, return a ``set()`` of the attribute keys which indicate a change in the state of this attribute. This is normally just ``set([attribute.key])``, but can be overridden to provide for additional keys. E.g. a :class:`.MutableComposite` augments this set with the attribute keys associated with the columns that comprise the composite value. This collection is consulted in the case of intercepting the :meth:`.InstanceEvents.refresh` and :meth:`.InstanceEvents.refresh_flush` events, which pass along a list of attribute names that have been refreshed; the list is compared against this set to determine if action needs to be taken. .. versionadded:: 1.0.5