graceguo-supercat commented on a change in pull request #11970:
URL:
https://github.com/apache/incubator-superset/pull/11970#discussion_r543765587
##########
File path: superset/connectors/sqla/models.py
##########
@@ -1467,6 +1473,29 @@ class and any keys added via `ExtraCache`.
extra_cache_keys += sqla_query.extra_cache_keys
return extra_cache_keys
+ def health_check(self, commit: bool = False, force: bool = False) -> None:
+ check = config["DATASET_HEALTH_CHECK"]
+ if check is None:
+ return
+
+ extra = self.extra_dict
+ # force re-run health check, or health check is updated
+ if force or extra.get("health_check", {}).get("version") !=
check.version:
+ with event_logger.log_context(action="dataset_health_check"):
+ message = check(self)
+ if message:
+ extra["health_check"] = {
+ "version": check.version,
+ "message": message,
+ }
Review comment:
It's not as strong as SupesetError. Error and Warning should be treated
differently.
Let's keep this PR as simple as it is, and we can reiterate when it is
really needed. The impact of this feature is still unknown to me, because it
depends **a lot** on the rule implementation. Let's run the core function with
some real examples before putting too much efforts on extras.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]