Skip to content

Commit

Permalink
fix #3035: handled none entity (#3036)
Browse files Browse the repository at this point in the history
  • Loading branch information
ulixius9 committed Mar 1, 2022
1 parent 3bc97e7 commit c59a5e8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions ingestion/src/metadata/ingestion/source/metabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def get_lineage(self, chart_list, dashboard_name):
for chart in chart_list:
try:
chart_details = chart["card"]
if not chart_details.get("table_id"):
continue
resp_tables = self.req_get(f"/api/table/{chart_details['table_id']}")
if resp_tables.status_code == 200:
table = resp_tables.json()
Expand All @@ -229,17 +231,18 @@ def get_lineage(self, chart_list, dashboard_name):
entity=Model_Dashboard, fqdn=dashboard_fqdn
)
logger.debug("from entity %s", table_entity)
lineage = AddLineageRequest(
edge=EntitiesEdge(
fromEntity=EntityReference(
id=table_entity.id.__root__, type="table"
),
toEntity=EntityReference(
id=chart_entity.id.__root__, type="dashboard"
),
if table_entity and chart_entity:
lineage = AddLineageRequest(
edge=EntitiesEdge(
fromEntity=EntityReference(
id=table_entity.id.__root__, type="table"
),
toEntity=EntityReference(
id=chart_entity.id.__root__, type="dashboard"
),
)
)
)
yield lineage
yield lineage
except Exception as err: # pylint: disable=broad-except,unused-variable
logger.error(traceback.print_exc())

Expand All @@ -264,6 +267,8 @@ def get_card_detail(self, card_list):
for card in card_list:
try:
card_details = card["card"]
if not card_details.get("id"):
continue
card_detail_resp = self.req_get(f"/api/card/{card_details['id']}")
if card_detail_resp.status_code == 200:
card = card_detail_resp.json()
Expand Down

0 comments on commit c59a5e8

Please sign in to comment.