Skip to content

Commit

Permalink
fix(ingest/unity): simplify MCP generation and reporting (#6911)
Browse files Browse the repository at this point in the history
Co-authored-by: John Joyce <[email protected]>
  • Loading branch information
hsheth2 and jjoyce0510 authored Jan 5, 2023
1 parent f651646 commit feaab3b
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 178 deletions.
8 changes: 7 additions & 1 deletion metadata-ingestion/src/datahub/emitter/mcp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dataclasses
import json
from typing import TYPE_CHECKING, Optional, Tuple, Union
from typing import TYPE_CHECKING, List, Optional, Tuple, Union

from datahub.emitter.aspect import ASPECT_MAP, TIMESERIES_ASPECT_MAP
from datahub.emitter.serialization_helper import post_json_transform, pre_json_transform
Expand Down Expand Up @@ -99,6 +99,12 @@ def __post_init__(self) -> None:
f"aspectName {self.aspectName} does not match aspect type {type(self.aspect)} with name {self.aspect.get_aspect_name()}"
)

@classmethod
def construct_many(
cls, entityUrn: str, aspects: List[Optional[_Aspect]]
) -> List["MetadataChangeProposalWrapper"]:
return [cls(entityUrn=entityUrn, aspect=aspect) for aspect in aspects if aspect]

def make_mcp(self) -> MetadataChangeProposalClass:
serializedEntityKeyAspect: Union[None, GenericAspectClass] = None
if isinstance(self.entityKeyAspect, DictWrapper):
Expand Down
Loading

0 comments on commit feaab3b

Please sign in to comment.