From 8bbfa8ccdc510a4256c2b9c8ede0cde8be415874 Mon Sep 17 00:00:00 2001 From: Aseem Bansal Date: Wed, 13 Nov 2024 18:42:11 +0530 Subject: [PATCH] fix(ingest/dbt): handle multiple owners (#11848) --- .../ingestion/source/dbt/dbt_common.py | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_common.py b/metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_common.py index c95d0e545c5989..b5d0ed42e651ea 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/dbt/dbt_common.py @@ -1822,16 +1822,21 @@ def _aggregate_owners( logger.debug( f"Owner after applying owner extraction pattern:'{self.config.owner_extraction_pattern}' is '{owner}'." ) - if self.config.strip_user_ids_from_email: - owner = owner.split("@")[0] - logger.debug(f"Owner (after stripping email):{owner}") - - owner_list.append( - OwnerClass( - owner=mce_builder.make_user_urn(owner), - type=OwnershipTypeClass.DATAOWNER, + if isinstance(owner, list): + owners = owner + else: + owners = [owner] + for owner in owners: + if self.config.strip_user_ids_from_email: + owner = owner.split("@")[0] + logger.debug(f"Owner (after stripping email):{owner}") + + owner_list.append( + OwnerClass( + owner=mce_builder.make_user_urn(owner), + type=OwnershipTypeClass.DATAOWNER, + ) ) - ) owner_list = sorted(owner_list, key=lambda x: x.owner) return owner_list