Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Commit

Permalink
fix(ingest): trino - fall back to default table comment method for al…
Browse files Browse the repository at this point in the history
…l Trino query errors (datahub-project#6873)
  • Loading branch information
marvin-roesch authored and cccs-Dustin committed Feb 1, 2023
1 parent 377a121 commit f4f0ca8
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions metadata-ingestion/src/datahub/ingestion/source/sql/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from sqlalchemy.sql import sqltypes
from sqlalchemy.types import TypeEngine
from trino.exceptions import TrinoQueryError
from trino.sqlalchemy import datatype, error
from trino.sqlalchemy import datatype
from trino.sqlalchemy.dialect import TrinoDialect

from datahub.ingestion.api.common import PipelineContext
Expand Down Expand Up @@ -82,13 +82,8 @@ def get_table_comment(self, connection, table_name: str, schema: str = None, **k

return {"text": properties.get("comment", None), "properties": properties}
# Fallback to default trino-sqlalchemy behaviour if `$properties` table doesn't exist
except TrinoQueryError as e:
if e.error_name in (
error.TABLE_NOT_FOUND,
error.COLUMN_NOT_FOUND,
error.NOT_FOUND,
):
return self.get_table_comment_default(connection, table_name, schema)
except TrinoQueryError:
return self.get_table_comment_default(connection, table_name, schema)
# Exception raised when using Starburst Delta Connector that falls back to a Hive Catalog
except exc.ProgrammingError as e:
if isinstance(e.orig, TrinoQueryError):
Expand Down

0 comments on commit f4f0ca8

Please sign in to comment.