def run_migration(target, engine=None): engine = engine or session.get_engine() engine.connect() config = alembic_config.Config(os.path.join(script_location, 'alembic.ini')) config.set_main_option('script_location', 'subunit2sql:migrations') config.subunit2sql_config = CONF with engine.begin() as connection: config.attributes['connection'] = connection command.upgrade(config, target) engine.dispose()
def reset(self): self._cache_schema() engine = session.get_engine() engine.dispose() engine.connect()
def cleanup(self): engine = session.get_engine() engine.dispose()