graceguo-supercat opened a new pull request #11970:
URL: https://github.com/apache/incubator-superset/pull/11970
### SUMMARY
Inside airbnb, we spent a lot of time on Superset dashboard and query
performance issues. We create some guidelines for airbnb users, to help them
write better queries to create virtual dataset. So we want to **_add a dataset
health check logic_** when user explore a chart, and show some warning message
if health check returns any message.
To decide whether a dataset is good or bad, this logic is probably very
specific to each corporation. Some rules applied in airbnb may totally not
relevant for Dropbox. So in the open source codebase, we only add an entry
point,
```DATASET_HEALTH_CHECK = _your function to check dataset_```
which allow each company to implement and hook their own rules.
For example, after implements a rule that checks if the chart is using a
virtual dataset:
```
def my_check(datasource) -> str:
message = ""
if datasource.type == "table" and datasource.sql:
message = "You should replace this virtual datasource with physical
table."
return message
```
I will see a warning message like this:
<img width="1406" alt="Screen Shot 2020-12-08 at 8 31 33 PM"
src="https://user-images.githubusercontent.com/27990562/101587949-1f6e4800-399a-11eb-88a1-84c13ff1ddae.png">
### TEST PLAN
CI
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [x] Changes UI
- [ ] Requires DB Migration.
- [ ] Confirm DB Migration upgrade and downgrade tested.
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
----------------------------------------------------------------
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]