コード例 #1
0
 def _configure(self, engine):
     """For each type of repository we should do some of configure steps.
     For migrate_repo we should set under version control our database.
     For alembic we should configure database settings. For this goal we
     should use oslo.config and openstack.commom.db.sqlalchemy.session with
     database functionality (reset default settings and session cleanup).
     """
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
コード例 #2
0
 def _configure(self, engine):
     """For each type of repository we should do some of configure steps.
     For migrate_repo we should set under version control our database.
     For alembic we should configure database settings. For this goal we
     should use oslo.config and openstack.commom.db.sqlalchemy.session with
     database functionality (reset default settings and session cleanup).
     """
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
コード例 #3
0
 def _alembic_command(self, alembic_command, engine, *args, **kwargs):
     """Most of alembic command return data into output.
     We should redefine this setting for getting info.
     """
     self.ALEMBIC_CONFIG.stdout = buf = io.StringIO()
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
     getattr(command, alembic_command)(*args, **kwargs)
     res = buf.getvalue().strip()
     LOG.debug('Alembic command `%s` returns: %s' % (alembic_command, res))
     session.cleanup()
     return res
コード例 #4
0
 def _alembic_command(self, alembic_command, engine, *args, **kwargs):
     """Most of alembic command return data into output.
     We should redefine this setting for getting info.
     """
     self.ALEMBIC_CONFIG.stdout = buf = io.StringIO()
     CONF.set_override('connection', str(engine.url), group='database')
     session.cleanup()
     getattr(command, alembic_command)(*args, **kwargs)
     res = buf.getvalue().strip()
     LOG.debug('Alembic command `%s` returns: %s' % (alembic_command, res))
     session.cleanup()
     return res
コード例 #5
0
ファイル: api.py プロジェクト: akshayms/savanna
def clear_db(base=model_base.SavannaBase):
    global _DB_ENGINE
    unregister_models(base)
    session.cleanup()
    _DB_ENGINE = None