Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Maiara Reinaldo <[email protected]>
  • Loading branch information
danielfordfc and maiarareinaldo authored Oct 24, 2023
1 parent 9324085 commit 34e0007
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions metadata-ingestion/src/datahub/ingestion/source/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,18 +516,18 @@ def __init__(
self.ignore_upstream_lineage_platforms = []

# if ignore upstream lineage platforms doesn't contain "postgres", then consult the upstream_postgres_database_whitelist
if "postgres" not in self.ignore_upstream_lineage_platforms:
if self.config.upstream_postgres_database_whitelist:
self.upstream_postgres_database_whitelist = [
x.strip()
for x in (
self.config.upstream_postgres_database_whitelist.split(",")
)
]
else:
# return empty list if the config is not set
self.upstream_postgres_database_whitelist = []
if (
"postgres" not in self.ignore_upstream_lineage_platforms
and self.config.upstream_postgres_database_whitelist
):
self.upstream_postgres_database_whitelist = [
x.strip()
for x in (
self.config.upstream_postgres_database_whitelist.split(",")
)
]
else:
# return empty list if the config is not set
self.upstream_postgres_database_whitelist = []


Expand Down Expand Up @@ -1043,12 +1043,7 @@ def get_upstream_tables(self, tables, datasource_name, browse_path, is_custom_sq

# skip upstream tables if the source is postgres and the database is not whitelisted
if table.get(tableau_constant.CONNECTION_TYPE) == "postgres":
upstream_db = (
table[tableau_constant.DATABASE][tableau_constant.NAME]
if table.get(tableau_constant.DATABASE)
and table[tableau_constant.DATABASE].get(tableau_constant.NAME)
else ""
)
upstream_db = table.get([tableau_constant.DATABASE], {}).get([tableau_constant.NAME], "")
if (
upstream_db
and upstream_db not in self.upstream_postgres_database_whitelist
Expand Down

0 comments on commit 34e0007

Please sign in to comment.