From 35d879dab474f11c6878de8f14bdd5d5ffc13aef Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 8 May 2024 13:46:36 +0100 Subject: [PATCH] add domain to mapping --- metadata-ingestion/src/datahub/utilities/mapping.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/metadata-ingestion/src/datahub/utilities/mapping.py b/metadata-ingestion/src/datahub/utilities/mapping.py index 005e7fdc6e0da0..3246efde0a18da 100644 --- a/metadata-ingestion/src/datahub/utilities/mapping.py +++ b/metadata-ingestion/src/datahub/utilities/mapping.py @@ -13,6 +13,7 @@ from datahub.emitter.mce_builder import OwnerType from datahub.metadata.schema_classes import ( AuditStampClass, + DomainsClass, InstitutionalMemoryClass, InstitutionalMemoryMetadataClass, OwnerClass, @@ -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" @@ -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 @@ -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: