def db_transaction(function):
@six.wraps(function)
def inner(*args, **kwargs):
config = alembic_cfg.Config(
os.path.join(os.path.dirname(__file__), 'alembic.ini'))
config.set_main_option(
'script_location',
'mistral.db.sqlalchemy.migration:alembic_migrations')
# attach the Mistral conf to the Alembic conf
config.mistral_config = CONF
CONF(project='mistral')
with db_api.transaction():
return function(*args, **kwargs)
return inner
评论列表
文章目录