Skip to content

Commit

Permalink
getting database directly from upstream tables incase there are multi…
Browse files Browse the repository at this point in the history
…ple databases in upstreamDatabases (#4447)
  • Loading branch information
cuong-pham authored Mar 18, 2022
1 parent 430ca10 commit 12bb2e1
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 2 deletions.
3 changes: 1 addition & 2 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,14 @@ def _create_upstream_table_lineage(
self, datasource: dict, project: str, is_custom_sql: bool = False
) -> List[UpstreamClass]:
upstream_tables = []
upstream_dbs = datasource.get("upstreamDatabases", [])
upstream_db = upstream_dbs[0].get("name", "") if upstream_dbs else ""

for table in datasource.get("upstreamTables", []):
# skip upstream tables when there is no column info when retrieving embedded datasource
# Schema details for these will be taken care in self.emit_custom_sql_ds()
if not is_custom_sql and not table.get("columns"):
continue

upstream_db = table.get("database", {}).get("name", "")
schema = self._get_schema(table.get("schema", ""), upstream_db)
table_urn = make_table_urn(
self.config.env,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class MetadataQueryException(Exception):
upstreamTables {
id
name
database {
name
}
schema
fullName
connectionType
Expand Down Expand Up @@ -214,6 +217,9 @@ class MetadataQueryException(Exception):
upstreamTables {
id
name
database {
name
}
schema
connectionType
}
Expand Down Expand Up @@ -255,6 +261,9 @@ class MetadataQueryException(Exception):
upstreamTables {
id
name
database {
name
}
schema
fullName
connectionType
Expand Down
Loading

0 comments on commit 12bb2e1

Please sign in to comment.