Skip to content

Commit

Permalink
fix(tableau): avoid duplicate schema in URNs for upstream tables (dat…
Browse files Browse the repository at this point in the history
…ahub-project#4645)

* fix(tableau): avoid duplicate schema in URNs for upstream tables

* Fix(lint)
  • Loading branch information
maaaikoool authored and maggiehays committed Aug 1, 2022
1 parent b7c2ba9 commit d85391e
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,29 +263,39 @@ def _create_upstream_table_lineage(
elif table["name"] is None:
continue

schema = table.get("schema", "")
table_name = table.get("name", "")
full_name = table.get("fullName", "")
upstream_db = table.get("database", {}).get("name", "")
logger.debug(
"Processing Table with Connection Type: {0} and id {1}".format(
table.get("connectionType", ""), table.get("id", "")
)
)
schema = self._get_schema(
table.get("schema", ""), upstream_db, table.get("fullName", "")
)
schema = self._get_schema(schema, upstream_db, full_name)
# if the schema is included within the table name we omit it
if (
schema
and table_name
and full_name
and table_name == full_name
and schema in table_name
):
schema = ""
table_urn = make_table_urn(
self.config.env,
upstream_db,
table.get("connectionType", ""),
schema,
table.get("name", ""),
table_name,
)

upstream_table = UpstreamClass(
dataset=table_urn,
type=DatasetLineageTypeClass.TRANSFORMED,
)
upstream_tables.append(upstream_table)
table_path = f"{project.replace('/', REPLACE_SLASH_CHAR)}/{datasource.get('name', '')}/{table.get('name', '')}"
table_path = f"{project.replace('/', REPLACE_SLASH_CHAR)}/{datasource.get('name', '')}/{table_name}"
self.upstream_tables[table_urn] = (
table.get("columns", []),
table_path,
Expand Down

0 comments on commit d85391e

Please sign in to comment.