Skip to content

Commit

Permalink
fix(ingest): fall back to default table comment method for all Trino …
Browse files Browse the repository at this point in the history
…query errors
  • Loading branch information
marvin-roesch committed Dec 29, 2022
1 parent 7d7da15 commit 3b44cdb
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 3b44cdb

Please sign in to comment.