def create_metadata(engine): metadata = initialize_schema() initialize_mappers(metadata.tables, metadata.views) # pylint: disable=E1101 metadata.bind = engine return metadata
from thelma.repositories.rdb.schema.migrations.util import get_db_url config = context.config # pylint:disable=E1101 db_url = get_db_url(config) # Use the pylons config file for logging configuration. Unfortunately, this # implies that the alembic logger needs to be configured there, not in the # alembic ini file. pylons_cfg_file_path = \ os.path.join(config.get_main_option('here'), config.file_config.get('alembic', 'pylons_config_file')) fileConfig(pylons_cfg_file_path) # customize this section for non-standard engine configurations. target_metadata = initialize_schema() def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output. """ # pylint:disable=E1101 context.configure(url=db_url,