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 |
|
Tracks state information at the class level. |
Class |
|
Factory for new ClassManager instances. |
Function | is |
Return True if the given attribute on the given instance is instrumented by the attributes package. |
Function | register |
Register class instrumentation. |
Function | unregister |
Unregister class instrumentation. |
Constant | DEL |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Undocumented |
Class | _ |
Provide serialization of a :class:`.ClassManager`. |
Function | _generate |
Build an __init__ decorator that triggers ClassManager events. |
Type Variable | _T |
Undocumented |
Variable | _instrumentation |
Undocumented |
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.
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.