module documentation

Defines SQLAlchemy's system of class instrumentation. This module is usually not directly visible to user applications, but defines a large part of the ORM's interactivity. instrumentation.py deals with registration of end-user classes for state tracking. It interacts closely with state.py and attributes.py which establish per-instance and per-class-attribute instrumentation, respectively. The class instrumentation system can be customized on a per-class or global basis using the :mod:`sqlalchemy.ext.instrumentation` module, which provides the means to build and specify alternate instrumentation forms. .. versionchanged: 0.8 The instrumentation extension system was moved out of the ORM and into the external :mod:`sqlalchemy.ext.instrumentation` package. When that package is imported, it installs itself within sqlalchemy.orm so that its more comprehensive resolution mechanics take effect.

Class ClassManager Tracks state information at the class level.
Class InstrumentationFactory Factory for new ClassManager instances.
Function is_instrumented Return True if the given attribute on the given instance is instrumented by the attributes package.
Function register_class Register class instrumentation.
Function unregister_class Unregister class instrumentation.
Constant DEL_ATTR Undocumented
Class _ExpiredAttributeLoaderProto Undocumented
Class _ManagerFactory Undocumented
Class _SerializeManager Provide serialization of a :class:`.ClassManager`.
Function _generate_init Build an __init__ decorator that triggers ClassManager events.
Type Variable _T Undocumented
Variable _instrumentation_factory Undocumented
def is_instrumented(instance, key): (source)

Return True if the given attribute on the given instance is instrumented by the attributes package. This function may be used regardless of instrumentation applied directly to the class, i.e. no descriptors are required.

def register_class(class_: Type[_O], finalize: bool = True, mapper: Optional[Mapper[_O]] = None, registry: Optional[_RegistryType] = None, declarative_scan: Optional[_MapperConfig] = None, expired_attribute_loader: Optional[_ExpiredAttributeLoaderProto] = None, init_method: Optional[Callable[..., None]] = None) -> ClassManager[_O]: (source)

Register class instrumentation. Returns the existing or newly created class manager.

def unregister_class(class_): (source)

Unregister class instrumentation.

DEL_ATTR = (source)

Undocumented

Value
util.symbol('DEL_ATTR')
def _generate_init(class_, class_manager, original_init): (source)

Build an __init__ decorator that triggers ClassManager events.

Undocumented

Value
TypeVar('_T',
        bound=Any)
_instrumentation_factory = (source)

Undocumented