From 461f63533ad3836dfb439ae1f73c14de6c7d9aaa Mon Sep 17 00:00:00 2001 From: sagar-salvi-apptware Date: Mon, 23 Sep 2024 21:01:58 +0530 Subject: [PATCH] fix(ingest/looker) : Handle DeserializeError to improve error reporting, underlying issue remains --- metadata-ingestion/setup.py | 2 ++ .../datahub/ingestion/source/looker/looker_source.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/metadata-ingestion/setup.py b/metadata-ingestion/setup.py index 8b778048c34757..e32e776c1aedaa 100644 --- a/metadata-ingestion/setup.py +++ b/metadata-ingestion/setup.py @@ -172,6 +172,8 @@ # LookML files with spaces between an item and the following comma. # See https://github.com/joshtemple/lkml/issues/73. "lkml>=1.3.4", + # Fixes https://github.com/looker-open-source/sdk-codegen/issues/1410 , cattrs appears to have introduced a breaking change starting in version 23.2. + "cattrs>=1.3,<23.2", *sqlglot_lib, "GitPython>2", "python-liquid", diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py index 71d497c56f13e8..f2ed9b4564119c 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py @@ -17,6 +17,7 @@ ) from looker_sdk.error import SDKError +from looker_sdk.rtl.serialize import DeserializeError from looker_sdk.sdk.api40.models import ( Dashboard, DashboardElement, @@ -1309,10 +1310,16 @@ def process_dashboard( dashboard_id=dashboard_id, fields=fields, ) - except SDKError: + except (SDKError, DeserializeError) as e: + logger.error(f"Failed to load dashboard from Looker API Error: {str(e)}") # A looker dashboard could be deleted in between the list and the get + error_type = ( + "Deserialization Error" + if isinstance(e, DeserializeError) + else "SDK Error" + ) self.reporter.report_warning( - title="Error Loading Dashboard", + title=f"Error Loading Dashboard: {error_type}", message="Error occurred while attempting to loading dashboard from Looker API. Skipping.", context=f"Dashboard ID: {dashboard_id}", )