Fixed Tableau ingestion issue (#6671)

* Fixed Tableau ingestion issue

* revmoved doc string

Co-authored-by: Onkar Ravgan <onkarravgan@Onkars-MacBook-Pro.local>
This commit is contained in:
Onkar Ravgan 2022-08-09 23:55:32 +05:30 committed by GitHub
parent ea2d5b8d60
commit af33cc0a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 14 deletions

View File

@ -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"]
}

View File

@ -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

View File

@ -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()

View File

@ -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:

View File

@ -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.

View File

@ -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.

View File

@ -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.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

After

Width:  |  Height:  |  Size: 413 KiB

View File

@ -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