-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: add Dataset tagging import/update api #22304
base: master
Are you sure you want to change the base?
feat: add Dataset tagging import/update api #22304
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22304 +/- ##
==========================================
- Coverage 67.18% 66.87% -0.31%
==========================================
Files 1903 1844 -59
Lines 74275 70433 -3842
Branches 8110 7670 -440
==========================================
- Hits 49898 47099 -2799
+ Misses 22265 21346 -919
+ Partials 2112 1988 -124
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1084 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -148,6 +156,26 @@ def import_dataset( | |||
return dataset | |||
|
|||
|
|||
def extract_tags(config: Dict[str, Any]) -> Tuple[Dict[str, Any], Optional[List[str]]]: | |||
tags = None | |||
if "tags" in config.keys() and feature_flag_manager.is_feature_enabled( |
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 see a broader usage in our app of is_feature_enabled
coming from this import directly from superset import is_feature_enabled
, any reason why not using that instead?
superset/datasets/dao.py
Outdated
@@ -167,6 +169,11 @@ def update( | |||
if "metrics" in properties: | |||
cls.update_metrics(model, properties.pop("metrics"), commit=commit) | |||
|
|||
if "tags" in properties and feature_flag_manager.is_feature_enabled( |
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.
same as above
return config, tags | ||
|
||
|
||
def import_tags(dataset: SqlaTable, existing: bool, tags: Optional[List[str]]) -> 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.
Looking at this method, it's only doing something if tags
has value in it, so why is tags
Optional
then? Can we just mark it as required and not call this method if tag if empty for example? or do you see a reason to keep it as is?
@@ -148,6 +156,26 @@ def import_dataset( | |||
return dataset | |||
|
|||
|
|||
def extract_tags(config: Dict[str, Any]) -> Tuple[Dict[str, Any], Optional[List[str]]]: |
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.
can we get a unit test for this util function
return config, tags | ||
|
||
|
||
def import_tags(dataset: SqlaTable, existing: bool, tags: Optional[List[str]]) -> 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.
can we get unit test for this function
superset/tags/utils.py
Outdated
from superset.tags.models import get_tag, ObjectTypes, Tag, TaggedObject, TagTypes | ||
|
||
|
||
def validate_custom_tags( |
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.
test?
superset/tags/utils.py
Outdated
|
||
|
||
def add_custom_object_tags( | ||
tags: List[str], |
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.
test?
Co-authored-by: Aleksey Karpov <[email protected]>
…tils/client-ws-app (apache#24501) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
… in /superset-websocket (apache#24522) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…websocket (apache#24524) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Justin Park <[email protected]>
…ataset-Tagging-Import/Update-API
4e2b091
to
0505f88
Compare
Hey @cccs-RyanK I moved this to a draft as it seems it requires a rebase. |
SUMMARY
This work is related to a previous PR which added the ability to tag datasets in the backend. This PR adds the support tobe able to add tags to datasets via the API.
Currently there is an ongoing PR to add tags to the front-end.
It is behind the TAGGING_SYSTEM feature flag
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
Tests added to tests/integration_tests/datasets/api_tests.py
ADDITIONAL INFORMATION