diff --git a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json index 95bf4380d8d..7bb6b2e4c60 100644 --- a/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json +++ b/catalog-rest-service/src/main/resources/json/schema/entity/services/connections/dashboard/tableauConnection.json @@ -47,6 +47,11 @@ "description": "Tableau Site Name.", "type": "string" }, + "siteUrl": { + "title": "Site Url", + "description": "Tableau Site Url.", + "type": "string" + }, "personalAccessTokenName": { "title": "Personal Access Token", "description": "Personal Access Token Name.", @@ -70,5 +75,5 @@ } }, "additionalProperties": false, - "required": ["apiVersion", "siteName", "env"] + "required": ["apiVersion", "env"] } diff --git a/ingestion/examples/workflows/tableau.yaml b/ingestion/examples/workflows/tableau.yaml index b40b963cf63..3bb729551ab 100644 --- a/ingestion/examples/workflows/tableau.yaml +++ b/ingestion/examples/workflows/tableau.yaml @@ -9,6 +9,7 @@ source: env: tableau_prod hostPort: http://localhost siteName: site_name + siteUrl: site_url apiVersion: api_version personalAccessTokenName: personal_access_token_name personalAccessTokenSecret: personal_access_token_secret diff --git a/ingestion/src/metadata/ingestion/source/dashboard/tableau.py b/ingestion/src/metadata/ingestion/source/dashboard/tableau.py index 29f7aacbf90..1fba0dc1ffe 100644 --- a/ingestion/src/metadata/ingestion/source/dashboard/tableau.py +++ b/ingestion/src/metadata/ingestion/source/dashboard/tableau.py @@ -14,6 +14,7 @@ Tableau source module import traceback from typing import Iterable, List, Optional +from requests.utils import urlparse from tableau_api_lib.utils.querying import ( get_views_dataframe, get_workbook_connections_dataframe, @@ -149,9 +150,11 @@ class TableauSource(DashboardServiceSource): Optional[EntityReference] """ owner = self.owner[dashboard_details["owner"]["id"]] - yield CreateUserRequest( - name=owner["name"], displayName=owner["fullName"], email=owner["email"] - ) + name = owner.get("name") + displayName = owner.get("fullName") + email = owner.get("email") + if name and email: + yield CreateUserRequest(name=name, displayName=displayName, email=email) def yield_tag(self, _) -> OMetaTagAndCategory: """ @@ -196,6 +199,8 @@ class TableauSource(DashboardServiceSource): Method to Get Dashboard Entity """ dashboard_tag = dashboard_details.get("tags") + workbook_url = urlparse(dashboard_details.get("webpageUrl")).fragment + dashboard_url = f"#{workbook_url}" yield CreateDashboardRequest( name=dashboard_details.get("id"), displayName=dashboard_details.get("name"), @@ -206,7 +211,7 @@ class TableauSource(DashboardServiceSource): for chart in self.context.charts ], tags=self.get_tag_lables(dashboard_tag), - dashboardUrl=dashboard_details.get("webpageUrl"), + dashboardUrl=dashboard_url, service=EntityReference( id=self.context.dashboard_service.id.__root__, type="dashboardService" ), @@ -284,10 +289,14 @@ class TableauSource(DashboardServiceSource): ): self.status.failure(chart["name"], "Chart Pattern not allowed") continue + workbook_name = dashboard_details["name"].replace(" ", "") + site_url = ( + f"site/{self.service_connection.siteUrl}/" + if self.service_connection.siteUrl + else "" + ) chart_url = ( - f"/#/site/{self.service_connection.siteName}/" - f"views/{dashboard_details['name']}/" - f"{chart['viewUrlName']}" + f"#/{site_url}" f"views/{workbook_name}/" f"{chart['viewUrlName']}" ) yield CreateChartRequest( name=chart["id"], @@ -305,3 +314,6 @@ class TableauSource(DashboardServiceSource): except Exception as err: logger.debug(traceback.format_exc()) logger.error(err) + + def close(self): + self.client.sign_out() diff --git a/ingestion/src/metadata/utils/connections.py b/ingestion/src/metadata/utils/connections.py index ab482351224..acd5b55996d 100644 --- a/ingestion/src/metadata/utils/connections.py +++ b/ingestion/src/metadata/utils/connections.py @@ -657,8 +657,8 @@ def _(connection: TableauConnection, verbose: bool = False): f"{connection.env}": { "server": connection.hostPort, "api_version": connection.apiVersion, - "site_name": connection.siteName, - "site_url": connection.siteName, + "site_name": connection.siteName if connection.siteName else "", + "site_url": connection.siteUrl if connection.siteUrl else "", } } if connection.username and connection.password: diff --git a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/airflow.md b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/airflow.md index 5d8af586555..d63df6da363 100644 --- a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/airflow.md +++ b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/airflow.md @@ -15,7 +15,8 @@ slug: /openmetadata/connectors/dashboard/tableau/airflow - **username**: Specify the User to connect to Tableau. It should have enough privileges to read all the metadata. - **password**: Password for Tableau. - **apiVersion**: Tableau API version. -- **siteName**: Tableau Site Name. +- **siteName**: Tableau Site Name. To be kept empty if you are using the default Tableau site +- **siteUrl**: Tableau Site Url. To be kept empty if you are using the default Tableau site - **personalAccessTokenName**: Access token. To be used if not logging in with user/password. - **personalAccessTokenSecret**: Access token Secret. To be used if not logging in with user/password. - **env**: Tableau Environment. diff --git a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/cli.md b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/cli.md index 9a73039efce..5edbfd21772 100644 --- a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/cli.md +++ b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/cli.md @@ -15,7 +15,8 @@ slug: /openmetadata/connectors/dashboard/tableau/cli - **username**: Specify the User to connect to Tableau. It should have enough privileges to read all the metadata. - **password**: Password for Tableau. - **apiVersion**: Tableau API version. -- **siteName**: Tableau Site Name. +- **siteName**: Tableau Site Name. To be kept empty if you are using the default Tableau site +- **siteUrl**: Tableau Site Url. To be kept empty if you are using the default Tableau site - **personalAccessTokenName**: Access token. To be used if not logging in with user/password. - **personalAccessTokenSecret**: Access token Secret. To be used if not logging in with user/password. - **env**: Tableau Environment. diff --git a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/index.md b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/index.md index 3c8688e6e3a..0c0a617a2c0 100644 --- a/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/index.md +++ b/openmetadata-docs/content/openmetadata/connectors/dashboard/tableau/index.md @@ -14,8 +14,9 @@ slug: /openmetadata/connectors/dashboard/tableau - **Host and Port**: URL to the Tableau instance. - **Username**: Specify the User to connect to Tableau. It should have enough privileges to read all the metadata. - **Password**: Password for Tableau. -- **API Version**: Tableau API version. -- **Site Name**: Tableau Site Name. +- **API Version**: Tableau API version. +- **Site Name**: Tableau Site Name. To be kept empty if you are using the default Tableau site +- **Site Url**: Tableau Site Url. To be kept empty if you are using the default Tableau site - **Personal Access Token**: Access token. To be used if not logging in with user/password. - **Personal Access Token Secret**: Access token Secret. To be used if not logging in with user/password. - **Environment**: Tableau Environment. diff --git a/openmetadata-docs/images/openmetadata/connectors/tableau/service-connection.png b/openmetadata-docs/images/openmetadata/connectors/tableau/service-connection.png index a64243b97c8..c4d908c3eab 100644 Binary files a/openmetadata-docs/images/openmetadata/connectors/tableau/service-connection.png and b/openmetadata-docs/images/openmetadata/connectors/tableau/service-connection.png differ diff --git a/openmetadata-docs/ingestion/connectors/tableau/ingestion.yaml b/openmetadata-docs/ingestion/connectors/tableau/ingestion.yaml index f40ad9aacde..9373b4385d9 100644 --- a/openmetadata-docs/ingestion/connectors/tableau/ingestion.yaml +++ b/openmetadata-docs/ingestion/connectors/tableau/ingestion.yaml @@ -9,6 +9,7 @@ source: env: tableau_prod hostPort: http://localhost siteName: site_name + siteUrl: site_url apiVersion: api_version personalAccessTokenName: personal_access_token_name personalAccessTokenSecret: personal_access_token_secret