Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GDP-2726] Add code for add_domain operation #54

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions metadata-ingestion/src/datahub/utilities/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from datahub.emitter.mce_builder import OwnerType
from datahub.metadata.schema_classes import (
AuditStampClass,
DomainsClass,
InstitutionalMemoryClass,
InstitutionalMemoryMetadataClass,
OwnerClass,
Expand Down Expand Up @@ -65,12 +66,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 @@ -288,6 +291,10 @@ def convert_to_aspects(
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

def get_operation_value(
Expand Down Expand Up @@ -370,6 +377,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
Loading