可扩展类检测。
这个 sqlalchemy.ext.instrumentation 包提供了ORM中类检测的备用系统。类检测是指ORM如何在类上放置属性,这些属性维护数据并跟踪对该数据的更改,以及安装在类上的事件挂钩。
注解
提供扩展包的目的是为了与其他对象管理包集成,这些对象管理包已经执行了自己的检测。不适用于一般用途。
有关如何使用工具扩展的示例,请参见示例 属性检测 .
| Object Name | Description |
|---|---|
延伸 |
|
返回检测实现的可扩展可调用程序序列 |
|
属性,在映射类上存在时选择自定义检测。 |
|
新ClassManager实例的工厂。 |
|
用户定义的类检测扩展。 |
属性,在映射类上存在时选择自定义检测。
允许类指定一种稍有不同或极为不同的技术来跟踪对映射属性和集合所做的更改。
在给定的对象继承层次结构中只允许一个检测实现。
此属性的值必须是可调用的,并且将传递一个类对象。可调用文件必须返回以下内容之一:
一个
InstrumentationManager或子类实现全部或部分InstrumentationManager(TODO)的对象
实现上述全部或部分内容的可调用字典(TODO)
一个
ClassManager或子类
一旦 sqlalchemy.ext.instrumentation 模块已导入。如果自定义查找程序安装在全局检测查找程序列表中,则它们可以选择或不选择使用此属性。
新ClassManager实例的工厂。
用户定义的类检测扩展。
InstrumentationManager 可以被子类化,以更改类检测的进行方式。该类的存在是为了与其他对象管理框架集成,这些框架希望完全修改ORM的检测方法,而不是为了常规使用。有关类检测事件的拦截,请参见 InstrumentationEvents .
这个类的API应该被认为是半稳定的,并且随着新版本的发布可能会略有变化。
sqlalchemy.ext.instrumentation.InstrumentationManager.dict_getter(class_)¶sqlalchemy.ext.instrumentation.InstrumentationManager.get_instance_dict(class_, instance)¶sqlalchemy.ext.instrumentation.InstrumentationManager.initialize_instance_dict(class_, instance)¶sqlalchemy.ext.instrumentation.InstrumentationManager.install_descriptor(class_, key, inst)¶sqlalchemy.ext.instrumentation.InstrumentationManager.install_member(class_, key, implementation)¶sqlalchemy.ext.instrumentation.InstrumentationManager.install_state(class_, instance, state)¶sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_attribute(class_, key, inst)¶sqlalchemy.ext.instrumentation.InstrumentationManager.instrument_collection_class(class_, key, collection_class)¶sqlalchemy.ext.instrumentation.InstrumentationManager.manage(class_, manager)¶sqlalchemy.ext.instrumentation.InstrumentationManager.manager_getter(class_)¶sqlalchemy.ext.instrumentation.InstrumentationManager.post_configure_attribute(class_, key, inst)¶sqlalchemy.ext.instrumentation.InstrumentationManager.remove_state(class_, instance)¶sqlalchemy.ext.instrumentation.InstrumentationManager.state_getter(class_)¶sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_descriptor(class_, key)¶sqlalchemy.ext.instrumentation.InstrumentationManager.uninstall_member(class_, key)¶sqlalchemy.ext.instrumentation.InstrumentationManager.unregister(class_, manager)¶返回检测实现的可扩展可调用程序序列
注册类时,每个可调用项都将传递一个类对象。如果没有返回,将查询序列中的下一个查找程序。否则,返回必须是一个仪器工厂,该工厂遵循与sqlacalchemy.ext.instruction.instruction_manager相同的准则。
默认情况下,唯一的查找工具是find_native_user_instruction_hook,它搜索instruction_manager。如果所有查找器都返回“无”,则使用标准ClassManager检测。
延伸 InstrumentationFactory 增加了簿记功能,以适应多种类型的类管理器。
flambé! the dragon and The Alchemist image designs created and generously donated by Rotem Yaari.
Created using Sphinx 4.2.0.