Skip to content

Commit

Permalink
fix(alembic): Making Alembic logger config optional (#17774)
Browse files Browse the repository at this point in the history
* Making Alembic logger config optional

* Switching to app config
  • Loading branch information
craig-rueda authored Dec 16, 2021
1 parent 3aa1161 commit b3db614
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
return None


#
# If True, we will skip the call to load the logger config found in alembic.init
#
ALEMBIC_SKIP_LOG_CONFIG = False

# Depending on the context in which this config is loaded, the
# version_info.json file may or may not be available, as it is
# generated on install via setup.py. In the event that we're
Expand Down
4 changes: 3 additions & 1 deletion superset/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)
if not current_app.config["ALEMBIC_SKIP_LOG_CONFIG"]:
# Skip loading logger config if the user has this config set
fileConfig(config.config_file_name)
logger = logging.getLogger("alembic.env")

DATABASE_URI = current_app.config["SQLALCHEMY_DATABASE_URI"]
Expand Down

0 comments on commit b3db614

Please sign in to comment.