def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ try: connectable = placement_db.get_placement_engine() except db_exc.CantStartEngineError: # We are being called from a context where the database hasn't been # configured so we need to set up Config and config the database. # This is usually the alembic command line. config = cfg.ConfigOpts() conf.register_opts(config) config([], project="placement", default_config_files=None) placement_db.configure(config) connectable = placement_db.get_placement_engine() with connectable.connect() as connection: context.configure(connection=connection, target_metadata=target_metadata) with context.begin_transaction(): context.run_migrations()
def get_engine(database='main', context=None): if database == 'main': return db_session.get_engine(context=context) if database == 'api': return db_session.get_api_engine() if database == 'placement': return placement_db.get_placement_engine()
def get_engine(self): return db_api.get_placement_engine()
def get_engine(): return placement_db.get_placement_engine()