Skip to content
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(cli): Add support for custom ownership types to dataproduct CLI #9762

Conversation

skrydal
Copy link
Collaborator

@skrydal skrydal commented Feb 1, 2024

The change allows user to specify urn of a custom ownership type in the type field of the ownership list.
The logic is preserved both ways (from_yaml and from_datahub) - there are tests in place for that.

Additionally the PR contains fix to some problems in _patch_ownership function:

  • "TECHNICAL_OWNER" string used directly instead of enum class value
  • If there was a difference between datahub graph and yaml file in list of owners with type defined then id was set wrongly - now it is fixed

I decided to keep predefined, enum-based choice list in dataproduct add_owner cli command - if support of ownership type urn is needed the change is required only within the add_owner function of dataproduct_cli.py - I can adjust it in this PR if needed.

@github-actions github-actions bot added ingestion PR or Issue related to the ingestion of metadata community-contribution PR or Issue raised by member(s) of DataHub Community datahub-community-champion PRs authored by DataHub Community Champions labels Feb 1, 2024
Copy link
Collaborator

@hsheth2 hsheth2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, but mostly looks good

@@ -332,6 +336,7 @@ def add_owner(urn: str, owner: str, owner_type: str) -> None:
if not urn.startswith("urn:li:dataProduct:"):
urn = f"urn:li:dataProduct:{urn}"
dataproduct_patcher: DataProductPatchBuilder = DataProduct.get_patch_builder(urn)
owner_type, owner_type_urn = validate_ownership_type(owner_type)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is owner_type_urn unused here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, as I mentioned in description, via this command we can not add custom ownership because we are bound by choices list. Nevertheless the variable should not be left unused, I added it to the OwnerClass. Thanks!

@skrydal
Copy link
Collaborator Author

skrydal commented Feb 5, 2024

@hsheth2 All the tests are passing, can we merge the PR?

@hsheth2 hsheth2 merged commit bf1ce96 into datahub-project:master Feb 5, 2024
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution PR or Issue raised by member(s) of DataHub Community datahub-community-champion PRs authored by DataHub Community Champions ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants