Skip to content

Commit a0f524b

Browse files
dungdm93ebyhr
authored andcommitted
return empty list when table un-partitioned
Signed-off-by: Đặng Minh Dũng <[email protected]>
1 parent ac4c458 commit a0f524b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

trino/sqlalchemy/dialect.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,14 @@ def get_indexes(self, connection: Connection, table_name: str, schema: str = Non
238238
raise exc.NoSuchTableError(f"schema={schema}, table={table_name}")
239239

240240
partitioned_columns = self._get_columns(connection, f"{table_name}$partitions", schema, **kw)
241+
if not partitioned_columns:
242+
return []
241243
partition_index = dict(
242-
name="partition", column_names=[col["name"] for col in partitioned_columns], unique=False
244+
name="partition",
245+
column_names=[col["name"] for col in partitioned_columns],
246+
unique=False
243247
)
244-
return [
245-
partition_index,
246-
]
248+
return [partition_index]
247249

248250
def get_sequence_names(self, connection: Connection, schema: str = None, **kw) -> List[str]:
249251
"""Trino has no support for sequences. Returns an empty list."""

0 commit comments

Comments
 (0)