Skip to content

Commit

Permalink
fix(ingest/trino): Avoid exception if $properties table empty or not …
Browse files Browse the repository at this point in the history
…readable (datahub-project#5447)

Under some configuration of access rules in Trino, the user may not have
read access to the content of the table, which will result in an exception
(`fetchone()` returns `None`)

This commit ensures no exception are raised and the ingestion can proceed.
  • Loading branch information
glinmac authored and maggiehays committed Aug 1, 2022
1 parent 064b307 commit 8d3ad11
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions metadata-ingestion/src/datahub/ingestion/source/sql/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ def get_table_comment(self, connection, table_name: str, schema: str = None, **k

# Generate properties dictionary.
properties = {}
for col_name, col_value in row.items():
properties[col_name] = col_value
if row:
for col_name, col_value in row.items():
properties[col_name] = col_value

return {"text": properties.get("comment", None), "properties": properties}
except TrinoQueryError as e:
Expand Down

0 comments on commit 8d3ad11

Please sign in to comment.