Skip to content

Commit

Permalink
feat(be/cfg): replace deprecated imp.load_source with importlib.util (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hainenber authored Oct 3, 2024
1 parent 6217cb6 commit 2aa9348
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# pylint: disable=too-many-lines
from __future__ import annotations

import imp # pylint: disable=deprecated-module
import importlib.util
import json
import logging
Expand Down Expand Up @@ -1885,7 +1884,9 @@ class ExtraDynamicQueryFilters(TypedDict, total=False):
cfg_path = os.environ[CONFIG_PATH_ENV_VAR]
try:
module = sys.modules[__name__]
override_conf = imp.load_source("superset_config", cfg_path)
spec = importlib.util.spec_from_file_location("superset_config", cfg_path)
override_conf = importlib.util.module_from_spec(spec)
spec.loader.exec_module(override_conf)
for key in dir(override_conf):
if key.isupper():
setattr(module, key, getattr(override_conf, key))
Expand Down

0 comments on commit 2aa9348

Please sign in to comment.