Skip to content

Commit

Permalink
fix for local variable 'datasource_urn' referenced before assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
llance committed Dec 17, 2024
1 parent b084b7b commit aca7830
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions metadata-ingestion/src/datahub/ingestion/source/superset.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,12 +548,13 @@ def construct_chart_from_chart_data(self, chart_data: dict) -> ChartSnapshot:

datasource_id = chart_data.get("datasource_id")
if not datasource_id:
logger.warning(f'chart {chart_data["id"]} has no datasource_id, skipping fetching dataset info')
logger.debug(f'chart {chart_data["id"]} has no datasource_id, skipping fetching dataset info')
datasource_urn = None
else:
dataset_response = self.get_dataset_info(datasource_id)
datasource_urn = self.get_datasource_urn_from_id(
datasource_urn = list(self.get_datasource_urn_from_id(
dataset_response, self.platform
)
))

params = json.loads(chart_data.get("params", "{}"))
metrics = [
Expand Down Expand Up @@ -598,7 +599,7 @@ def construct_chart_from_chart_data(self, chart_data: dict) -> ChartSnapshot:
title=title,
lastModified=last_modified,
chartUrl=chart_url,
inputs=[datasource_urn] if datasource_urn else None,
inputs=datasource_urn,
customProperties=custom_properties,
)
chart_snapshot.aspects.append(chart_info)
Expand Down

0 comments on commit aca7830

Please sign in to comment.