From 8972ea4b04f76185c3797ca8572276d664df48db Mon Sep 17 00:00:00 2001 From: Harshal Sheth Date: Wed, 21 Dec 2022 04:25:24 -0500 Subject: [PATCH] fix(ingest): support patches in `auto_status_aspect` (#6827) Patches generate a raw MCP because MCPW doesn't support patches right now, so we need to handle that correctly downstream. --- .../src/datahub/utilities/source_helpers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/utilities/source_helpers.py b/metadata-ingestion/src/datahub/utilities/source_helpers.py index b64c053bc9..2b771aa2a9 100644 --- a/metadata-ingestion/src/datahub/utilities/source_helpers.py +++ b/metadata-ingestion/src/datahub/utilities/source_helpers.py @@ -5,7 +5,11 @@ from datahub.ingestion.api.workunit import MetadataWorkUnit from datahub.ingestion.source.state.stale_entity_removal_handler import ( StaleEntityRemovalHandler, ) -from datahub.metadata.schema_classes import MetadataChangeEventClass, StatusClass +from datahub.metadata.schema_classes import ( + MetadataChangeEventClass, + MetadataChangeProposalClass, + StatusClass, +) from datahub.utilities.urns.urn import guess_entity_type @@ -40,6 +44,9 @@ def auto_status_aspect( elif isinstance(wu.metadata, MetadataChangeProposalWrapper): if isinstance(wu.metadata.aspect, StatusClass): status_urns.add(urn) + elif isinstance(wu.metadata, MetadataChangeProposalClass): + if wu.metadata.aspectName == StatusClass.ASPECT_NAME: + status_urns.add(urn) else: raise ValueError(f"Unexpected type {type(wu.metadata)}")