From 2c4d8c73c03e6ea71d0b162e37688319adf26d84 Mon Sep 17 00:00:00 2001 From: ulixius9 Date: Thu, 5 Sep 2024 08:47:37 +0530 Subject: [PATCH 1/2] GEN-1251: Fix Expected ColumnLineage but got dict --- .../ingestion/ometa/mixins/lineage_mixin.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py b/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py index a3e1da1870c3..78c6f87e3f7a 100644 --- a/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py +++ b/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py @@ -22,7 +22,7 @@ from metadata.generated.schema.api.lineage.addLineage import AddLineageRequest from metadata.generated.schema.entity.services.databaseService import DatabaseService -from metadata.generated.schema.type.entityLineage import EntitiesEdge +from metadata.generated.schema.type.entityLineage import ColumnLineage, EntitiesEdge from metadata.generated.schema.type.entityReference import EntityReference from metadata.ingestion.lineage.models import ConnectionTypeDialectMapper from metadata.ingestion.lineage.parser import LINEAGE_PARSING_TIMEOUT @@ -138,6 +138,18 @@ def add_lineage( ) ) + serialized_col_details = [] + for col_lin in data.edge.lineageDetails.columnsLineage: + serialized_col_details.append(ColumnLineage(**col_lin)) + data.edge.lineageDetails.columnsLineage = serialized_col_details + + serialized_col_details_og = [] + for col_lin in original.edge.lineageDetails.columnsLineage: + serialized_col_details_og.append(ColumnLineage(**col_lin)) + original.edge.lineageDetails.columnsLineage = ( + serialized_col_details_og + ) + # Keep the pipeline information from the original # lineage if available if ( From e88fc768dcaa33975cc9ec352f33e3d23c54afcb Mon Sep 17 00:00:00 2001 From: ulixius9 Date: Thu, 5 Sep 2024 08:49:29 +0530 Subject: [PATCH 2/2] handle none --- .../src/metadata/ingestion/ometa/mixins/lineage_mixin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py b/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py index 78c6f87e3f7a..44b9fe538bb0 100644 --- a/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py +++ b/ingestion/src/metadata/ingestion/ometa/mixins/lineage_mixin.py @@ -139,12 +139,12 @@ def add_lineage( ) serialized_col_details = [] - for col_lin in data.edge.lineageDetails.columnsLineage: + for col_lin in data.edge.lineageDetails.columnsLineage or []: serialized_col_details.append(ColumnLineage(**col_lin)) data.edge.lineageDetails.columnsLineage = serialized_col_details serialized_col_details_og = [] - for col_lin in original.edge.lineageDetails.columnsLineage: + for col_lin in original.edge.lineageDetails.columnsLineage or []: serialized_col_details_og.append(ColumnLineage(**col_lin)) original.edge.lineageDetails.columnsLineage = ( serialized_col_details_og