-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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(api): Add option to enable sync on import #20312
feat(api): Add option to enable sync on import #20312
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20312 +/- ##
==========================================
- Coverage 66.82% 66.47% -0.36%
==========================================
Files 1799 1763 -36
Lines 68884 67720 -1164
Branches 7319 7052 -267
==========================================
- Hits 46031 45014 -1017
+ Misses 20966 20907 -59
+ Partials 1887 1799 -88
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 |
34d62bb
to
8a1bb3c
Compare
8a1bb3c
to
82234a3
Compare
passwords=passwords, | ||
overwrite=overwrite, | ||
sync_columns=sync_columns, | ||
sync_metrics=sync_metrics, |
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.
Side note, I see that V0.ImportDatasetsCommand will use the sync kwargs but not V1.
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.
cc @betodealmeida is that intentional? ☝️ Or do we need to port over the sync functionality to V1 as well?
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.
It appears that V1 uses the overwrite flag to denote syncing columns and metrics.
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'm a bit confused here... passing sync_columns
and sync_metrics
to ImportDatasetsCommand
has no effect, as far as I can see. Can you explain more the use case for this, @reesercollins?
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.
sync_columns
and sync_metrics
means the import command will remove columns and metrics which don't appear in the dataset YAML.
superset/superset/datasets/commands/importers/v0.py
Lines 249 to 252 in 76d6a9a
if kwargs.get("sync_columns"): | |
self.sync.append("columns") | |
if kwargs.get("sync_metrics"): | |
self.sync.append("metrics") |
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.
Ah, that makes sense, it's for the v0 API! Yeah, in this case it should be fine... the v1 API will ignore these extra arguments, and should be fine.
But then my next question is... any reason why you're still using the v0 API, instead of enabling the VERSIONED_EXPORT
feature flag? The v0 import IMHO is very buggy, the code is incomplete and non-standard across asset types, and we should deprecated it as soon as possible.
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.
We have some automation we haven't gotten around to updating which generates the YAML files. We very rarely do any exporting.
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.
@reesercollins This looks good. Do you mind writing a test that validates that passing in this kwarg to the api will work? 🙏
@eschutho looks like this might be ready to merge if it meets your standards :) |
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.
Thanks @reesercollins!
@reesercollins sorry, this slipped under my/our radar again 🤦 |
SUMMARY
In order to bring the API more in line with the CLI, I have added the ability to specify
sync_columns
andsync_metrics
when using the API.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Set
sync_columns
orsync_metrics
to true. The API should behave like the CLI when those flags are set.ADDITIONAL INFORMATION