Skip to content

Commit

Permalink
add domain to mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
eesanoble committed May 8, 2024
1 parent 22e5f4e commit 35d879d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions metadata-ingestion/src/datahub/utilities/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from datahub.emitter.mce_builder import OwnerType
from datahub.metadata.schema_classes import (
AuditStampClass,
DomainsClass,
InstitutionalMemoryClass,
InstitutionalMemoryMetadataClass,
OwnerClass,
Expand Down Expand Up @@ -71,12 +72,14 @@ class Constants:
ADD_TERM_OPERATION = "add_term"
ADD_TERMS_OPERATION = "add_terms"
ADD_OWNER_OPERATION = "add_owner"
ADD_DOMAIN_OPERATION = "add_domain"
OPERATION = "operation"
OPERATION_CONFIG = "config"
TAG = "tag"
TERM = "term"
DOC_LINK = "link"
DOC_DESCRIPTION = "description"
DOMAIN = "domain"
OWNER_TYPE = "owner_type"
OWNER_CATEGORY = "owner_category"
MATCH = "match"
Expand Down Expand Up @@ -291,6 +294,9 @@ def convert_to_aspects(
logger.error(
f"Error while constructing aspect for documentation link and description : {e}"
)
if Constants.ADD_DOMAIN_OPERATION in operation_map:
domain_aspect = DomainsClass(domains=[operation_map[Constants.ADD_DOMAIN_OPERATION]])
aspect_map[Constants.ADD_DOMAIN_OPERATION] = domain_aspect

return aspect_map

Expand Down Expand Up @@ -374,6 +380,8 @@ def get_operation_value(
for term in captured_terms.split(separator)
if term.strip()
]
elif operation_type == Constants.ADD_DOMAIN_OPERATION:
return mce_builder.make_domain_urn(operation_config[Constants.DOMAIN])
return None

def sanitize_owner_ids(self, owner_id: str) -> str:
Expand Down

0 comments on commit 35d879d

Please sign in to comment.