From 107cd6484a3d0ea3c65211cd8b90efbd1627f233 Mon Sep 17 00:00:00 2001 From: sagar-salvi-apptware <159135491+sagar-salvi-apptware@users.noreply.github.com> Date: Fri, 4 Oct 2024 03:14:21 +0530 Subject: [PATCH] fix(ingest/looker) : Handle DeserializeError to improve error reporting. (#11457) Co-authored-by: Harshal Sheth --- .../datahub/ingestion/source/looker/looker_common.py | 12 +++++++++++- .../datahub/ingestion/source/looker/looker_source.py | 6 ++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_common.py b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_common.py index 1f54767de5a68..3cbb13375229b 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_common.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_common.py @@ -21,6 +21,7 @@ ) from looker_sdk.error import SDKError +from looker_sdk.rtl.serialize import DeserializeError from looker_sdk.sdk.api40.models import ( LookmlModelExplore, LookmlModelExploreField, @@ -1131,7 +1132,16 @@ def from_api( # noqa: C901 logger.warning( f"Failed to extract explore {explore_name} from model {model}: {e}" ) - + except DeserializeError as e: + reporter.warning( + title="Failed to fetch explore from the Looker API", + message=( + "An error occurred while extracting the explore from the model. " + "Please check the explore and model configurations." + ), + context=f"Explore: {explore_name}, Model: {model}", + exc=e, + ) except AssertionError: reporter.report_warning( title="Unable to find Views", 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 e593e132dafd7..f269ccf1cd98f 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py +++ b/metadata-ingestion/src/datahub/ingestion/source/looker/looker_source.py @@ -16,6 +16,7 @@ ) from looker_sdk.error import SDKError +from looker_sdk.rtl.serialize import DeserializeError from looker_sdk.sdk.api40.models import ( Dashboard, DashboardElement, @@ -1288,12 +1289,13 @@ def process_dashboard( dashboard_id=dashboard_id, fields=fields, ) - except SDKError: + except (SDKError, DeserializeError) as e: # A looker dashboard could be deleted in between the list and the get self.reporter.report_warning( - title="Error Loading Dashboard", + title="Failed to fetch dashboard from the Looker API", message="Error occurred while attempting to loading dashboard from Looker API. Skipping.", context=f"Dashboard ID: {dashboard_id}", + exc=e, ) return [], None, dashboard_id, start_time, datetime.datetime.now()