From 328a204d44aaba9eb801dc991e1e3a7071d306a9 Mon Sep 17 00:00:00 2001 From: varunbharill Date: Wed, 20 Oct 2021 14:42:07 -0700 Subject: [PATCH] fix(ingest): fix error when extracting lineage in bigquery is turned off. (#3428) --- .../src/datahub/ingestion/source/sql/bigquery.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/sql/bigquery.py b/metadata-ingestion/src/datahub/ingestion/source/sql/bigquery.py index 94ef7373f8..d4f896f59e 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/sql/bigquery.py +++ b/metadata-ingestion/src/datahub/ingestion/source/sql/bigquery.py @@ -229,12 +229,13 @@ class BigQuerySource(SQLAlchemySource): def get_lineage_mcp( self, dataset_urn: str ) -> Optional[MetadataChangeProposalWrapper]: + if self.lineage_metadata is None: + return None dataset_key: Optional[DatasetKey] = mce_builder.dataset_urn_to_key(dataset_urn) if dataset_key is None: return None project_id, dataset_name, tablename = dataset_key.name.split(".") bq_table = BigQueryTableRef(project_id, dataset_name, tablename) - assert self.lineage_metadata is not None if str(bq_table) in self.lineage_metadata: upstream_list: List[UpstreamClass] = [] # Sorting the list of upstream lineage events in order to avoid creating multiple aspects in backend