Skip to content

Commit

Permalink
update mcp.py and recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonhyejin committed Dec 23, 2024
1 parent 8e18be9 commit b50a148
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source:
type: mlflow
config:
tracking_uri: "http://127.0.0.1:5000"

sink:
type: datahub-rest
config:
server: "http://localhost:8080"
9 changes: 7 additions & 2 deletions metadata-ingestion/src/datahub/emitter/mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
SystemMetadataClass,
_Aspect,
)
from datahub.utilities.urns.urn import guess_entity_type
from datahub.utilities.urns.urn import Urn, guess_entity_type

if TYPE_CHECKING:
from datahub.ingestion.api.workunit import MetadataWorkUnit
Expand Down Expand Up @@ -71,7 +71,11 @@ class MetadataChangeProposalWrapper:
systemMetadata: Union[None, SystemMetadataClass] = None

def __post_init__(self) -> None:
if self.entityUrn and self.entityType == _ENTITY_TYPE_UNSET:
if isinstance(self.entityUrn, Urn):
if self.entityType == _ENTITY_TYPE_UNSET:
self.entityType = self.entityUrn.entity_type
self.entityUrn = str(self.entityUrn)
elif self.entityUrn and self.entityType == _ENTITY_TYPE_UNSET:
self.entityType = guess_entity_type(self.entityUrn)
elif self.entityUrn and self.entityType:
guessed_entity_type = guess_entity_type(self.entityUrn).lower()
Expand Down Expand Up @@ -105,6 +109,7 @@ def construct_many(
return [cls(entityUrn=entityUrn, aspect=aspect) for aspect in aspects if aspect]

def _make_mcp_without_aspects(self) -> MetadataChangeProposalClass:
assert self.entityUrn is None or isinstance(self.entityUrn, str)
return MetadataChangeProposalClass(
entityType=self.entityType,
entityUrn=self.entityUrn,
Expand Down

0 comments on commit b50a148

Please sign in to comment.