Skip to content

Commit

Permalink
refactor(ingest): Browse Paths Upgrade Tableau (#6008)
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoyce0510 authored Sep 23, 2022
1 parent f57f398 commit 7845488
Show file tree
Hide file tree
Showing 3 changed files with 8,223 additions and 8,229 deletions.
16 changes: 5 additions & 11 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,9 @@ def _create_upstream_table_lineage(

table_path = None
if project and datasource.get("name"):
table_name = table.get("name") or table["id"]
table_path = f"{project.replace('/', REPLACE_SLASH_CHAR)}/{datasource['name']}/{table_name}"
table_path = (
f"{project.replace('/', REPLACE_SLASH_CHAR)}/{datasource['name']}"
)

self.upstream_tables[table_urn] = (
table.get("columns", []),
Expand Down Expand Up @@ -565,12 +566,11 @@ def emit_custom_sql_datasources(self) -> Iterable[MetadataWorkUnit]:
dataset_snapshot.aspects.append(schema_metadata)

# Browse path
csql_name = csql.get("name") or csql_id

if project and datasource_name:
browse_paths = BrowsePathsClass(
paths=[
f"/{self.config.env.lower()}/{self.platform}/{project}/{datasource['name']}/{csql_name}"
f"/{self.config.env.lower()}/{self.platform}/{project}/{datasource['name']}"
]
)
dataset_snapshot.aspects.append(browse_paths)
Expand Down Expand Up @@ -787,9 +787,7 @@ def emit_datasource(
datasource_name = f"{workbook['name']}/{datasource_name}"
# Browse path
browse_paths = BrowsePathsClass(
paths=[
f"/{self.config.env.lower()}/{self.platform}/{project}/{datasource_name}"
]
paths=[f"/{self.config.env.lower()}/{self.platform}/{project}"]
)
dataset_snapshot.aspects.append(browse_paths)

Expand Down Expand Up @@ -1070,13 +1068,11 @@ def emit_sheets_as_charts(self, workbook: Dict) -> Iterable[MetadataWorkUnit]:
yield wu

if workbook.get("projectName") and workbook.get("name"):
sheet_name = sheet.get("name") or sheet["id"]
# Browse path
browse_path = BrowsePathsClass(
paths=[
f"/{self.platform}/{workbook['projectName'].replace('/', REPLACE_SLASH_CHAR)}"
f"/{workbook['name']}"
f"/{sheet_name.replace('/', REPLACE_SLASH_CHAR)}"
]
)
chart_snapshot.aspects.append(browse_path)
Expand Down Expand Up @@ -1245,13 +1241,11 @@ def emit_dashboards(self, workbook: Dict) -> Iterable[MetadataWorkUnit]:
yield wu

if workbook.get("projectName") and workbook.get("name"):
dashboard_name = title or dashboard["id"]
# browse path
browse_paths = BrowsePathsClass(
paths=[
f"/{self.platform}/{workbook['projectName'].replace('/', REPLACE_SLASH_CHAR)}"
f"/{workbook['name'].replace('/', REPLACE_SLASH_CHAR)}"
f"/{dashboard_name}"
]
)
dashboard_snapshot.aspects.append(browse_paths)
Expand Down
Loading

0 comments on commit 7845488

Please sign in to comment.