diff --git a/trino/sqlalchemy/dialect.py b/trino/sqlalchemy/dialect.py index 52da4ac3..edcc372c 100644 --- a/trino/sqlalchemy/dialect.py +++ b/trino/sqlalchemy/dialect.py @@ -297,7 +297,12 @@ 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 = self._get_columns(connection, f"{table_name}$partitions", schema, **kw) + partitioned_columns = None + try: + partitioned_columns = self._get_columns(connection, f"{table_name}$partitions", schema, **kw) + except Exception as e: + # e.g. it's not a Hive table or an unpartitioned Hive table + logger.debug("Couldn't fetch partition columns. schema: %s, table: %s, error: %s", schema, table_name, e) if not partitioned_columns: return [] partition_index = dict(