-
Notifications
You must be signed in to change notification settings - Fork 3k
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(ingestion): Add typeUrn handling to ownership transformers #9370
feat(ingestion): Add typeUrn handling to ownership transformers #9370
Conversation
596ac62
to
903ddbe
Compare
Seems like the failing test case is not related at all to the code change (it's Cypress UI test) |
Seems like this PR might be also fixing problems such as #8441 |
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 did a similar thing here #9332
I'd like to do something similar, where you can provide either an urn or a legacy enum value in the ownership_type
field. Main reason is that I think having two separate fields will be confusing for end users
Hi @hsheth2, thank you for your answer. Providing If above assumption is correct, then we are currently in transition period supporting both ownership type "styles" and, at some point, setting ownership based on |
I think ultimately the public interface that people think about is "this ownership is of this type", and don't really care/distinguish between type and typeUrn. In the dbt PR, what we do is look at the user-provided type - if it begins with I don't see us getting rid of the old ownership types anytime soon, so I suspect we'll be in this hybrid state for a bit. |
e183c99
to
e6e13a6
Compare
@hsheth2 |
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.
Mostly looks good - thanks for adding the tests too
There's some additional simplification that we could do here, those aren't blockers for merging this PR
@@ -102,7 +98,7 @@ def transform_aspect( | |||
|
|||
|
|||
class DatasetOwnershipBaseConfig(TransformerSemanticsConfigModel): | |||
ownership_type: Optional[str] = OwnershipTypeClass.DATAOWNER | |||
ownership_type: Optional[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.
we don't need to do this in this PR, but it might simplify some of the cast
calls away
ownership_type: Optional[str] | |
ownership_type: str = OwnershipTypeClass.DATAOWNER |
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.
Reverted to that (changed it in first place due to addition of another field, now removed).
if ownership_type is None: | ||
return OwnershipTypeClass.DATAOWNER, None | ||
try: | ||
ownership_type_str = cast(str, ownership_type) |
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 think this cast call isn't required
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.
Indeed, refactored and simplified this function
@@ -210,7 +210,8 @@ def test_simple_dataset_ownership_transformation(mock_time): | |||
"owner_urns": [ | |||
builder.make_user_urn("person1"), | |||
builder.make_user_urn("person2"), | |||
] | |||
], | |||
"ownership_type": "DATAOWNER", |
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.
are these defaults necessary - it looks like validate_ownership_type will add this default right?
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.
Mainly just want to double check that this change is 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.
I removed "ownership_type"
from this test case, kept it in other one so that we have better coverage of different cases.
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.
LGTM
Changed behavior of both ownership transformers by adding possibility to define
ownership_type_urn
, as well as removing default value of ownership_type (it will be populated as CUSTOM if user defines ownership_type_urn). This way the transformers maintain backward compatibility as long as the users don't base on default value forownership_type
(ifownership_type
is set but notownership_type_urn
transformers work as before, setting the ownership withouttypeUrn
.Fixes #8441