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(ingest): Add GenericAspectTransformer #7994

Merged

Conversation

amanda-her
Copy link
Contributor

Checklist

  • The PR conforms to DataHub's Contributing Guideline (particularly Commit Message Format)
  • Links to related issues (if applicable)
  • Tests for the changes have been added/updated (if applicable)
  • Docs related to the changes have been added/updated (if applicable). If a new feature has been added a Usage Guide has been added for the same.
  • For any breaking change/potential downtime/deprecation/big changes an entry has been made in Updating DataHub

@github-actions github-actions bot added the ingestion PR or Issue related to the ingestion of metadata label May 9, 2023
@Khurzak
Copy link
Contributor

Khurzak commented May 10, 2023

With these changes, our aim is to create the infrastructure that will allow creating transformers to consume generic aspects.
A new GenericAspectTransformer with the following goals:

  • Support GenericAspectClass instead of Aspect
  • When an aspect is transformed return MetadataChangeProposalClass instead of MetadataChangeProposalWrapper

BaseTransformer has been extended to support MetadataChangeProposalClass

Copy link
Collaborator

@asikowitz asikowitz left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution to datahub! I think GenericAspectTransformer may be more appropriate as another mixin (like LegacyMCETransformer and SingleAspectTransformer, but this works as is.

Comment on lines +77 to +80
elif isinstance(envelope.record, MetadataChangeEventClass):
self._record_mce(envelope.record)
elif isinstance(envelope.record, MetadataChangeProposalWrapper):
self._record_mcp(envelope.record)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can handle both these cases by:

  • Pulling the appropriate aspect out of the MCE
  • Converting the MCPW into a MCP with make_mcp

Comment on lines +30 to +34
def transform_aspect(
self, entity_urn: str, aspect_name: str, aspect: Optional[Aspect]
) -> Optional[Aspect]:
"""Do not implement."""
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

I can see for simplicity why you inherited from SimpleAspectTransformer, but I think it's awkward we're essentially ignoring the main method of that class.

@asikowitz asikowitz merged commit 0e0d893 into datahub-project:master May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ingestion PR or Issue related to the ingestion of metadata
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants