oslo_db.api
Module¶A DB backend module should implement a method named ‘get_backend’ which takes no arguments. The method can return any object that implements DB API methods.
oslo_db.api.
DBAPI
(backend_name, backend_mapping=None, lazy=False, **kwargs)¶Bases: object
Initialize the chosen DB API backend.
After initialization API methods is available as normal attributes of
DBAPI
subclass. Database API methods are supposed to be called as
DBAPI instance methods.
Parameters: |
|
---|---|
Default backend_mapping: | |
None |
|
Default lazy: | False |
from_config
(conf, backend_mapping=None, lazy=False)¶Initialize DBAPI instance given a config instance.
Parameters: |
|
---|
oslo_db.api.
retry_on_deadlock
(f)¶Retry a DB API call if Deadlock was received.
wrap_db_entry will be applied to all db.api functions marked with this decorator.
oslo_db.api.
retry_on_request
(f)¶Retry a DB API call if RetryRequest exception was received.
wrap_db_entry will be applied to all db.api functions marked with this decorator.
oslo_db.api.
safe_for_db_retry
(f)¶Indicate api method as safe for re-connection to database.
Database connection retries will be enabled for the decorated api method. Database connection failure can have many causes, which can be temporary. In such cases retry may increase the likelihood of connection.
Usage:
@safe_for_db_retry
def api_method(self):
self.engine.connect()
Parameters: | f (function.) – database api method. |
---|
oslo_db.api.
wrap_db_retry
(retry_interval=1, max_retries=20, inc_retry_interval=True, max_retry_interval=10, retry_on_disconnect=False, retry_on_deadlock=False, retry_on_request=False, exception_checker=<function <lambda>>)¶Bases: object
Retry db.api methods, if db_error raised
Retry decorated db.api methods. This decorator catches db_error and retries function in a loop until it succeeds, or until maximum retries count will be reached.
Keyword arguments:
Parameters: |
|
---|
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.