module documentation

Extensible class instrumentation. The :mod:`sqlalchemy.ext.instrumentation` package provides for alternate systems of class instrumentation within the ORM. Class instrumentation refers to how the ORM places attributes on the class which maintain data and track changes to that data, as well as event hooks installed on the class. .. note:: The extension package is provided for the benefit of integration with other object management packages, which already perform their own instrumentation. It is not intended for general use. For examples of how the instrumentation extension is used, see the example :ref:`examples_instrumentation`.

Class ExtendedInstrumentationRegistry Extends :class:`.InstrumentationFactory` with additional bookkeeping, to accommodate multiple types of class managers.
Class InstrumentationManager User-defined class instrumentation extension.
Function find_native_user_instrumentation_hook Find user-specified instrumentation management for a class.
Constant INSTRUMENTATION_MANAGER Attribute, elects custom instrumentation when present on a mapped class.
Variable instrumentation_finders An extensible sequence of callables which return instrumentation implementations
Class _ClassInstrumentationAdapter Adapts a user-defined InstrumentationManager to a ClassManager.
Function _install_instrumented_lookups Replace global class/object management functions with ExtendedInstrumentationRegistry implementations, which allow multiple types of class managers to be present, at the cost of performance.
Function _install_lookups Undocumented
Function _reinstall_default_lookups Restore simplified lookups.
Variable _instrumentation_factory Undocumented
def find_native_user_instrumentation_hook(cls): (source)

Find user-specified instrumentation management for a class.

INSTRUMENTATION_MANAGER: str = (source)

Attribute, elects custom instrumentation when present on a mapped class. Allows a class to specify a slightly or wildly different technique for tracking changes made to mapped attributes and collections. Only one instrumentation implementation is allowed in a given object inheritance hierarchy. The value of this attribute must be a callable and will be passed a class object. The callable must return one of: - An instance of an :class:`.InstrumentationManager` or subclass - An object implementing all or some of InstrumentationManager (TODO) - A dictionary of callables, implementing all or some of the above (TODO) - An instance of a :class:`.ClassManager` or subclass This attribute is consulted by SQLAlchemy instrumentation resolution, once the :mod:`sqlalchemy.ext.instrumentation` module has been imported. If custom finders are installed in the global instrumentation_finders list, they may or may not choose to honor this attribute.

Value
'__sa_instrumentation_manager__'
instrumentation_finders = (source)

An extensible sequence of callables which return instrumentation implementations When a class is registered, each callable will be passed a class object. If None is returned, the next finder in the sequence is consulted. Otherwise the return must be an instrumentation factory that follows the same guidelines as sqlalchemy.ext.instrumentation.INSTRUMENTATION_MANAGER. By default, the only finder is find_native_user_instrumentation_hook, which searches for INSTRUMENTATION_MANAGER. If all finders return None, standard ClassManager instrumentation is used.

def _install_instrumented_lookups(): (source)

Replace global class/object management functions with ExtendedInstrumentationRegistry implementations, which allow multiple types of class managers to be present, at the cost of performance. This function is called only by ExtendedInstrumentationRegistry and unit tests specific to this behavior. The _reinstall_default_lookups() function can be called after this one to re-establish the default functions.

def _install_lookups(lookups): (source)

Undocumented

def _reinstall_default_lookups(): (source)

Restore simplified lookups.

_instrumentation_factory = (source)

Undocumented