Skip to content

Commit

Permalink
fix(tableau): fixes missed lineage (#12434)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgomezvillamor authored Jan 30, 2025
1 parent f527c5e commit d091fff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
26 changes: 14 additions & 12 deletions metadata-ingestion/src/datahub/ingestion/source/tableau/tableau.py
Original file line number Diff line number Diff line change
Expand Up @@ -2428,10 +2428,12 @@ def parse_custom_sql(
]
],
) -> Optional["SqlParsingResult"]:
database_info = datasource.get(c.DATABASE) or {
c.NAME: c.UNKNOWN.lower(),
c.CONNECTION_TYPE: datasource.get(c.CONNECTION_TYPE),
}
database_field = datasource.get(c.DATABASE) or {}
database_id: Optional[str] = database_field.get(c.ID)
database_name: Optional[str] = database_field.get(c.NAME) or c.UNKNOWN.lower()
database_connection_type: Optional[str] = database_field.get(
c.CONNECTION_TYPE
) or datasource.get(c.CONNECTION_TYPE)

if (
datasource.get(c.IS_UNSUPPORTED_CUSTOM_SQL) in (None, False)
Expand All @@ -2440,10 +2442,7 @@ def parse_custom_sql(
logger.debug(f"datasource {datasource_urn} is not created from custom sql")
return None

if (
database_info.get(c.NAME) is None
or database_info.get(c.CONNECTION_TYPE) is None
):
if database_connection_type is None:
logger.debug(
f"database information is missing from datasource {datasource_urn}"
)
Expand All @@ -2459,14 +2458,14 @@ def parse_custom_sql(

logger.debug(f"Parsing sql={query}")

upstream_db = database_info.get(c.NAME)
upstream_db = database_name

if func_overridden_info is not None:
# Override the information as per configuration
upstream_db, platform_instance, platform, _ = func_overridden_info(
database_info[c.CONNECTION_TYPE],
database_info.get(c.NAME),
database_info.get(c.ID),
database_connection_type,
database_name,
database_id,
self.config.platform_instance_map,
self.config.lineage_overrides,
self.config.database_hostname_to_platform_instance_map,
Expand Down Expand Up @@ -2534,6 +2533,9 @@ def _create_lineage_from_unsupported_csql(
platform_instance=self.config.platform_instance,
func_overridden_info=get_overridden_info,
)
logger.debug(
f"_create_lineage_from_unsupported_csql parsed_result = {parsed_result}"
)

if parsed_result is None:
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def make_dataset_urn(


def get_overridden_info(
connection_type: Optional[str],
connection_type: str,
upstream_db: Optional[str],
upstream_db_id: Optional[str],
platform_instance_map: Optional[Dict[str, str]],
Expand Down

0 comments on commit d091fff

Please sign in to comment.