from oslo.config import cfg from heat.openstack.common.db import api as db_api db_opts = [ cfg.StrOpt('db_backend', default='sqlalchemy', help='The backend to use for db.') ] CONF = cfg.CONF CONF.register_opts(db_opts) _BACKEND_MAPPING = {'sqlalchemy': 'heat.db.sqlalchemy.api'} IMPL = db_api.DBAPI(backend_mapping=_BACKEND_MAPPING) def get_session(): return IMPL.get_session() def raw_template_get(context, template_id): return IMPL.raw_template_get(context, template_id) def raw_template_create(context, values): return IMPL.raw_template_create(context, values) def resource_data_get_all(resource):
supported backend. ''' from oslo.config import cfg from heat.openstack.common.db import api as db_api CONF = cfg.CONF CONF.import_opt('backend', 'heat.openstack.common.db.options', group='database') _BACKEND_MAPPING = {'sqlalchemy': 'heat.db.sqlalchemy.api'} IMPL = db_api.DBAPI(CONF.database.backend, backend_mapping=_BACKEND_MAPPING, lazy=True) def get_engine(): return IMPL.get_engine() def get_session(): return IMPL.get_session() def raw_template_get(context, template_id): return IMPL.raw_template_get(context, template_id)