fix: Config for dataset health check (#12906)

This commit is contained in:
Grace Guo
2021-02-02 22:41:25 -08:00
committed by GitHub
parent 9fa52d3e21
commit fd2d87340b
2 changed files with 16 additions and 5 deletions

View File

@@ -1074,6 +1074,15 @@ GLOBAL_ASYNC_QUERIES_JWT_SECRET = "test-secret-change-me"
GLOBAL_ASYNC_QUERIES_TRANSPORT = "polling"
GLOBAL_ASYNC_QUERIES_POLLING_DELAY = 500
# It's possible to add a dataset health check logic which is specific to your system.
# It will get executed each time when user open a chart's explore view.
DATASET_HEALTH_CHECK = None
# -------------------------------------------------------------------
# * WARNING: STOP EDITING HERE *
# -------------------------------------------------------------------
# Don't add config values below this line since local configs won't be
# able to override them.
if CONFIG_PATH_ENV_VAR in os.environ:
# Explicitly import config module that is not necessarily in pythonpath; useful
# for case where app is being executed via pex.
@@ -1100,7 +1109,3 @@ elif importlib.util.find_spec("superset_config") and not is_test():
except Exception:
logger.exception("Found but failed to import local superset_config")
raise
# It's possible to add a dataset health check logic which is specific to your system.
# It will get executed each time when user open a chart's explore view.
DATASET_HEALTH_CHECK = None

View File

@@ -704,7 +704,13 @@ class SqlaTable( # pylint: disable=too-many-public-methods,too-many-instance-at
data_["fetch_values_predicate"] = self.fetch_values_predicate
data_["template_params"] = self.template_params
data_["is_sqllab_view"] = self.is_sqllab_view
data_["health_check_message"] = self.health_check_message
# Don't return previously populated health check message in case
# the health check feature is turned off
data_["health_check_message"] = (
self.health_check_message
if config.get("DATASET_HEALTH_CHECK")
else None
)
return data_
@property