Fix alembic messing up logging (#423)

This commit is contained in:
Jonathan Zernik 2020-11-09 21:43:51 -05:00 committed by GitHub
parent 1fb1c62a62
commit efd12e8332
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -11,7 +11,8 @@ config = context.config
# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
if config.attributes.get('configure_logger', True):
fileConfig(config.config_file_name)
# add your model's MetaData object here
# for 'autogenerate' support

View file

@ -5,6 +5,7 @@ from alembic import command
def run_migrations(engine):
""" Run migrations. """
alembic_cfg = Config("alembic.ini")
alembic_cfg.attributes['configure_logger'] = False
with engine.begin() as connection:
alembic_cfg.attributes['connection'] = connection
command.upgrade(alembic_cfg, "head")