mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
Added tableau owner test connection step (#11436)
* Added tableau owner test connection * typo fixed * remvoed generic exception
This commit is contained in:
parent
e5b5095ad5
commit
c7902344cb
@ -11,7 +11,7 @@
|
||||
"""
|
||||
Wrapper module of TableauServerConnection client
|
||||
"""
|
||||
from typing import Any, Callable, Dict, List
|
||||
from typing import Any, Callable, Dict, List, Optional
|
||||
|
||||
from cached_property import cached_property
|
||||
from tableau_api_lib import TableauServerConnection
|
||||
@ -24,6 +24,7 @@ from metadata.ingestion.source.dashboard.tableau import (
|
||||
from metadata.ingestion.source.dashboard.tableau.models import (
|
||||
TableauChart,
|
||||
TableauDashboard,
|
||||
TableauOwner,
|
||||
TableauSheets,
|
||||
)
|
||||
from metadata.ingestion.source.dashboard.tableau.queries import (
|
||||
@ -34,6 +35,12 @@ from metadata.utils.logger import ometa_logger
|
||||
logger = ometa_logger()
|
||||
|
||||
|
||||
class TableauOwnersNotFound(Exception):
|
||||
"""
|
||||
Raise when Owner information is not retrieved from the Tableau APIs
|
||||
"""
|
||||
|
||||
|
||||
class TableauClient:
|
||||
"""
|
||||
Wrapper to TableauServerConnection
|
||||
@ -69,6 +76,15 @@ class TableauClient:
|
||||
def query_views_for_site(self) -> Callable:
|
||||
return self._client.query_views_for_site
|
||||
|
||||
def get_owners(self) -> Optional[List[TableauOwner]]:
|
||||
owners = [workbook.owner for workbook in self.get_workbooks()]
|
||||
if len(owners) > 0:
|
||||
return owners
|
||||
raise TableauOwnersNotFound(
|
||||
"Unable to fetch Dashboard Owners from tableau\n"
|
||||
"Please check if the user has permissions to access the Owner information"
|
||||
)
|
||||
|
||||
def get_workbooks(self) -> List[TableauDashboard]:
|
||||
return [
|
||||
TableauDashboard(**workbook)
|
||||
|
||||
@ -87,6 +87,7 @@ def test_connection(
|
||||
content_id=client.site_id,
|
||||
parameter_dict=TABLEAU_GET_VIEWS_PARAM_DICT,
|
||||
),
|
||||
"GetOwners": client.get_owners,
|
||||
}
|
||||
|
||||
test_connection_steps(
|
||||
|
||||
@ -22,6 +22,12 @@
|
||||
"description": "List the Views (charts) from a given Workbook.",
|
||||
"errorMessage": "Failed to fetch views(charts), please validate if user has access to fetch views",
|
||||
"mandatory": false
|
||||
},
|
||||
{
|
||||
"name": "GetOwners",
|
||||
"description": "Validate if the Owner information is retrieved for Workbooks",
|
||||
"errorMessage": "Failed to fetch Workbook Owners, please validate if user has access to fetch Owners",
|
||||
"mandatory": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user