Add exception handling for tableau sheets (#11429)

* Add exception handling for tableau sheets

* remove meating
This commit is contained in:
Mayur Singal 2023-05-04 16:38:27 +05:30 committed by GitHub
parent 3ce6e102e6
commit 6ddf7034ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,6 @@
"""
Wrapper module of TableauServerConnection client
"""
import json
from typing import Any, Callable, Dict, List
from cached_property import cached_property
@ -94,9 +93,12 @@ class TableauClient:
data_model_graphql_result = self._client.metadata_graphql_query(
query=TABLEAU_SHEET_QUERY_BY_ID.format(id=sheet_id)
)
return TableauSheets(
**json.loads(data_model_graphql_result.text).get("data", [])
)
if data_model_graphql_result:
resp = data_model_graphql_result.json()
if resp and resp.get("data"):
return TableauSheets(**resp.get("data"))
return TableauSheets(sheets=[])
def sign_out(self) -> None:
self._client.sign_out()