fix(ingest/looker): handle sdk error for folder_ancestors (#11575)

This commit is contained in:
Mayuri Nehate 2024-10-10 20:51:49 +05:30 committed by GitHub
parent a219316b30
commit 9df65e8635
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -196,11 +196,25 @@ class LookerAPI:
fields: Union[str, List[str]] = ["id", "name", "parent_id"],
) -> Sequence[Folder]:
self.client_stats.folder_calls += 1
return self.client.folder_ancestors(
folder_id,
self.__fields_mapper(fields),
transport_options=self.transport_options,
)
try:
return self.client.folder_ancestors(
folder_id,
self.__fields_mapper(fields),
transport_options=self.transport_options,
)
except SDKError as e:
if "Looker Not Found (404)" in str(e):
# Folder ancestors not found
logger.info(
f"Could not find ancestors for folder with id {folder_id}: 404 error"
)
else:
logger.warning(
f"Could not find ancestors for folder with id {folder_id}"
)
logger.warning(f"Failure was {e}")
# Folder ancestors not found
return []
def all_connections(self):
self.client_stats.all_connections_calls += 1