-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
[dashboard] use filter_scopes metadata when import old dashboard #9145
[dashboard] use filter_scopes metadata when import old dashboard #9145
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9145 +/- ##
=======================================
Coverage 59.06% 59.06%
=======================================
Files 372 372
Lines 11922 11922
Branches 2919 2919
=======================================
Hits 7042 7042
Misses 4698 4698
Partials 182 182 Continue to review full report at Codecov.
|
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.
I trust u. Just a few questions.
superset/models/helpers.py
Outdated
@@ -278,6 +278,12 @@ def alter_params(self, **kwargs): | |||
d.update(kwargs) | |||
self.params = json.dumps(d) | |||
|
|||
def remove_params(self, param, **kwargs): |
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.
Do we pass in **kwargs
to this function anywhere? If not, can remove the kwargs
parts.
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.
also, typing plz ❤️
@@ -334,6 +323,29 @@ def alter_positions(dashboard, old_to_new_slc_id_dict): | |||
old_slc_id_str | |||
] | |||
|
|||
# since PR #9109, filter_immune_slices and filter_immune_slice_fields |
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.
Is there any way we can avoid having this special logic? I'm worried about code in Superset getting (even more) bloated. When will create_from_import
have the extra fields? Will it always? Is it ok to just not support this case and warn that your change is not backwards compatible?
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.
export dashboard
and import dashboard
is a widely used feature in Superset. it helps ppl to move dashboard from different data system (and both of them use Superset). If someone wants to copy a dashboard from an older system which didn't upgrade recently, but the other system used updated version, this PR can make their export - import routine keep working.
if the backward compatible only introduce a couple of lines, I would like to keep it. But if it will introduce a lot of overhead, i will not maintain it.
superset/models/helpers.py
Outdated
@@ -278,6 +278,12 @@ def alter_params(self, **kwargs): | |||
d.update(kwargs) | |||
self.params = json.dumps(d) | |||
|
|||
def remove_params(self, param_to_remove: str, **kwargs: Dict) -> 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.
add typing. is it looks better?
superset/models/helpers.py
Outdated
def remove_params(self, param, **kwargs): | ||
d = self.params_dict | ||
d.pop(param, None) | ||
d.update(kwargs) |
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.
used kwargs
here.
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.
sorry, what I meant was - is this function ever called with keyword arguments? It looks like you only called it with the positional argument param_to_remove
, so I don't thiink we need the kwargs logic.
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. Thanks!
8856258
to
d428247
Compare
CATEGORY
Choose one
SUMMARY
Update dashboard import action: convert old
filter_immune_slices
andfilter_immune_slice_fields
to usefilter_scopes
TEST PLAN
CI and unit test
ADDITIONAL INFORMATION
REVIEWERS
@john-bodley @serenajiang @mistercrunch @etr2460