The apmec.db.db_base Module

The apmec.db.db_base Module

class apmec.db.db_base.CommonDbMixin

Bases: object

Common methods used in core and service plugins.

classmethod register_model_query_hook(model, name, query_hook, filter_hook, result_filters=None)

Register a hook to be invoked when a query is executed.

Add the hooks to the _model_query_hooks dict. Models are the keys of this dict, whereas the value is another dict mapping hook names to callables performing the hook. Each hook has a “query” component, used to build the query expression and a “filter” component, which is used to build the filter expression.

Query hooks take as input the query being built and return a transformed query expression.

Filter hooks take as input the filter expression being built and return a transformed filter expression

safe_reference

Return a weakref to the instance.

Minimize the potential for the instance persisting unnecessarily in memory by returning a weakref proxy that won’t prevent deallocation.

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.