Skip to content

Commit

Permalink
fix the exception handling in get_indexes func based on [the review…
Browse files Browse the repository at this point in the history
… comment](#426 (comment))
  • Loading branch information
LittleWat committed Dec 18, 2023
1 parent 2232541 commit 338147b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions trino/sqlalchemy/dialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
OAuth2Authentication,
)
from trino.dbapi import Cursor
from trino.exceptions import TrinoUserError
from trino.sqlalchemy import compiler, datatype, error

logger = logging.get_logger(__name__)
Expand Down Expand Up @@ -281,11 +280,11 @@ def get_indexes(self, connection: Connection, table_name: str, schema: str = Non
if not self.has_table(connection, table_name, schema):
raise exc.NoSuchTableError(f"schema={schema}, table={table_name}")

partitioned_columns = None
try:
partitioned_columns = self._get_columns(connection, f"{table_name}$partitions", schema, **kw)
# some connector does not support $partitions table suffix so trying without appending that
except TrinoUserError:
partitioned_columns = self._get_columns(connection, table_name, schema, **kw)
except Exception as e:
logger.debug("Couldn't fetch partition columns for ... err: %s", e)
if not partitioned_columns:
return []
partition_index = dict(
Expand Down

0 comments on commit 338147b

Please sign in to comment.