class documentation

class ClassManager(HasMemoized, Dict[str, 'QueryableAttribute[Any]'], Generic[_O], EventTarget): (source)

Known subclasses: sqlalchemy.ext.instrumentation._ClassInstrumentationAdapter

View In Hierarchy

Tracks state information at the class level.

Method __bool__ All ClassManagers are non-zero regardless of attribute state.
Method __eq__ Undocumented
Method __hash__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method deferred_scalar_loader.setter Undocumented
Method dict_getter Undocumented
Method get_impl Undocumented
Method has_parent TODO
Method has_state Undocumented
Method initialize_collection Undocumented
Method install_descriptor Undocumented
Method install_member Undocumented
Method instrument_attribute Undocumented
Method instrument_collection_class Undocumented
Method is_instrumented Undocumented
Method manage Mark this instance as the manager for its class.
Method manager_getter Undocumented
Method new_instance Undocumented
Method post_configure_attribute Undocumented
Method setup_instance Undocumented
Method state_getter Return a (instance) -> InstanceState callable.
Method subclass_managers Undocumented
Method teardown_instance Undocumented
Method uninstall_descriptor Undocumented
Method uninstall_member Undocumented
Method uninstrument_attribute Undocumented
Method unregister remove all instrumentation established by this ClassManager.
Class Variable registry Undocumented
Instance Variable class_ Undocumented
Instance Variable declarative_scan Undocumented
Instance Variable dispatch Undocumented
Instance Variable expired_attribute_loader previously known as deferred_scalar_loader
Instance Variable factory Undocumented
Instance Variable info Undocumented
Instance Variable init_method Undocumented
Instance Variable local_attrs Undocumented
Instance Variable mapper Undocumented
Instance Variable new_init Undocumented
Instance Variable original_init Undocumented
Instance Variable originals Undocumented
Property attributes Undocumented
Property deferred_scalar_loader Undocumented
Property is_mapped Undocumented
Method _all_key_set Undocumented
Method _all_sqla_attributes return an iterator of all classbound attributes that are implement :class:`.InspectionAttr`.
Method _attr_has_impl Return True if the given attribute is fully initialized.
Method _collection_impl_keys Undocumented
Method _finalize Undocumented
Method _get_class_attr_mro return an attribute on the class without tripping it.
Method _instrument_init Undocumented
Method _loader_impls Undocumented
Method _new_state_if_none Install a default InstanceState if none is present.
Method _scalar_loader_impls Undocumented
Method _serialize Undocumented
Method _subclass_manager Create a new ClassManager for a subclass of this ClassManager's class.
Method _update_state Undocumented
Class Variable _state_setter Undocumented
Instance Variable _bases Undocumented
Instance Variable _finalized Undocumented
Property _state_constructor Undocumented
def __bool__(self) -> bool: (source)

All ClassManagers are non-zero regardless of attribute state.

def __eq__(self, other: Any) -> bool: (source)

Undocumented

def __hash__(self) -> int: (source)

Undocumented

def __init__(self, class_): (source)
def __repr__(self) -> str: (source)

Undocumented

@deferred_scalar_loader.setter
@util.deprecated('1.4', message='The ClassManager.deferred_scalar_loader attribute is now named expired_attribute_loader')
def deferred_scalar_loader(self, obj): (source)

Undocumented

def get_impl(self, key: str) -> AttributeImpl: (source)

Undocumented

def has_parent(self, state: InstanceState[_O], key: str, optimistic: bool = False) -> bool: (source)

TODO

def has_state(self, instance: _O) -> bool: (source)
def install_descriptor(self, key: str, inst: QueryableAttribute[Any]): (source)
def install_member(self, key: str, implementation: Any): (source)
def instrument_attribute(self, key: str, inst: QueryableAttribute[Any], propagated: bool = False): (source)
def instrument_collection_class(self, key: str, collection_class: Type[Collection[Any]]) -> _CollectionFactoryType: (source)
def is_instrumented(self, key: str, search: bool = False) -> bool: (source)

Undocumented

def manage(self): (source)

Mark this instance as the manager for its class.

def post_configure_attribute(self, key): (source)
def setup_instance(self, instance: _O, state: Optional[InstanceState[_O]] = None): (source)
@util.hybridmethod
def state_getter(self): (source)

Return a (instance) -> InstanceState callable. "state getter" callables should raise either KeyError or AttributeError if no InstanceState could be found for the instance.

def subclass_managers(self, recursive): (source)

Undocumented

def teardown_instance(self, instance: _O): (source)
def uninstall_descriptor(self, key: str): (source)
def uninstall_member(self, key: str): (source)
def uninstrument_attribute(self, key, propagated=False): (source)

Undocumented

def unregister(self): (source)

remove all instrumentation established by this ClassManager.

registry = (source)

Undocumented

Undocumented

declarative_scan = (source)

Undocumented

dispatch = (source)

Undocumented

expired_attribute_loader = (source)

previously known as deferred_scalar_loader

Undocumented

Undocumented

init_method = (source)

Undocumented

local_attrs: dict = (source)

Undocumented

@util.memoized_property
mapper = (source)

Undocumented

new_init = (source)

Undocumented

original_init = (source)

Undocumented

originals: dict = (source)

Undocumented

Undocumented

@property
@util.deprecated('1.4', message='The ClassManager.deferred_scalar_loader attribute is now named expired_attribute_loader')
deferred_scalar_loader = (source)

Undocumented

Undocumented

@HasMemoized.memoized_attribute
def _all_key_set(self): (source)

Undocumented

def _all_sqla_attributes(self, exclude=None): (source)

return an iterator of all classbound attributes that are implement :class:`.InspectionAttr`. This includes :class:`.QueryableAttribute` as well as extension types such as :class:`.hybrid_property` and :class:`.AssociationProxy`.

def _attr_has_impl(self, key: str) -> bool: (source)

Return True if the given attribute is fully initialized. i.e. has an impl.

@HasMemoized.memoized_attribute
def _collection_impl_keys(self): (source)

Undocumented

def _finalize(self): (source)

Undocumented

def _get_class_attr_mro(self, key, default=None): (source)

return an attribute on the class without tripping it.

def _instrument_init(self): (source)

Undocumented

@HasMemoized.memoized_attribute
def _loader_impls(self): (source)

Undocumented

def _new_state_if_none(self, instance: _O) -> Union[Literal[False], InstanceState[_O]]: (source)

Install a default InstanceState if none is present. A private convenience method used by the __init__ decorator.

@HasMemoized.memoized_attribute
def _scalar_loader_impls(self): (source)

Undocumented

def _serialize(self, state: InstanceState[_O], state_dict: Dict[str, Any]) -> _SerializeManager: (source)

Undocumented

def _subclass_manager(self, cls: Type[_T]) -> ClassManager[_T]: (source)

Create a new ClassManager for a subclass of this ClassManager's class. This is called automatically when attributes are instrumented so that the attributes can be propagated to subclasses against their own class-local manager, without the need for mappers etc. to have already pre-configured managers for the full class hierarchy. Mappers can post-configure the auto-generated ClassManager when needed.

def _update_state(self, finalize: bool = False, 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): (source)

Undocumented

_state_setter = (source)

Undocumented

Undocumented

_finalized: bool = (source)

Undocumented

@util.memoized_property
_state_constructor: Type[state.InstanceState[_O]] = (source)

Undocumented