-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(explore): add config for default time filter #21879
feat(explore): add config for default time filter #21879
Conversation
99ea6dd
to
d2b48ee
Compare
Codecov Report
@@ Coverage Diff @@
## master #21879 +/- ##
==========================================
- Coverage 66.90% 66.73% -0.17%
==========================================
Files 1806 1806
Lines 69130 69131 +1
Branches 7391 7391
==========================================
- Hits 46249 46136 -113
- Misses 20970 21084 +114
Partials 1911 1911
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Related to issue apache#13125 First change to complete apache#13125: We add a new configuration `DEFAULT_TIME_FILTER` to allow admins to set a global deafult time filter for any explore charts. By default this is set to `None`, which replicates the previous behavior. To get a default filter of -1w the configuration can be set to `'Last week'`. There is a minor change in behavior `UPDATE_FORM_DATA_BY_DATASOURCE`, the time filter is not reset anymore (the time dimension does still). This is similar to the behavior of other globally configured filters such as the row limit for explore.
f1a73af
to
b9bc98d
Compare
superset/config.py
Outdated
@@ -153,6 +153,9 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]: | |||
SAMPLES_ROW_LIMIT = 1000 | |||
# max rows retrieved by filter select auto complete | |||
FILTER_SELECT_ROW_LIMIT = 10000 | |||
# default time filter in explore | |||
# values may be "Last day", "Last week", "<ISO date> : now", etc. | |||
DEFAULT_TIME_FILTER = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one nite, we should keep this config as before, the None
and the No filter
will generate different time expressions. the None
will generate : today
(col <= today()), and No filter
will generate :
(empty filter).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
77a6b26
to
30e0f1a
Compare
Using "No filter" string instead of None to avoid issues downstream if None is not properly handled.
30e0f1a
to
809b365
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This config item is very useful in the production environment. LGTM, Thanks for the contribution!
Hi, we are running superset 1.5.1rc1 right now and i guess in that there is no such support of |
Yes, it should be same as |
SUMMARY
First change to complete #13125: We add a new configuration
DEFAULT_TIME_FILTER
to allow admins to set a global default time filter for any new explore charts. By default this is set toNone
, which replicates the previous behavior ("No filter"
). To get a default filter of -1w the configuration can be set to'Last week'
or any other value understood by Superset.There is a minor change in behavior
UPDATE_FORM_DATA_BY_DATASOURCE
(when switching dataset in explore), the time filter is not reset anymore. This is similar to the behavior of other globally configured filters such as the row limit for explore, which also do not reset.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
New explore chart with
DEFAULT_TIME_FILTER = None
:New explore chart with
DEFAULT_TIME_FILTER = "Last week"
:TESTING INSTRUCTIONS
Test default behavior
updated
(time) as a dimension (helps to verify)Expected: No time filter is applied when running the chart
Test with new configuration
DEFAULT_TIME_FILTER = "2020-06-01T00:00:00 : now"
inconfig.py
updated
(time) as dimension (helps to verify)Expected: Default time filter is applied
ADDITIONAL INFORMATION