This is an automated email from the ASF dual-hosted git repository.
johnbodley pushed a commit to branch john-bodley--trino-presto
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/john-bodley--trino-presto by
this push:
new c7f04ee390 Update presto.py
c7f04ee390 is described below
commit c7f04ee3904424e2c067af71f4e7c81c5906f338
Author: John Bodley <[email protected]>
AuthorDate: Fri Jul 15 20:03:46 2022 -0700
Update presto.py
---
superset/db_engine_specs/presto.py | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/superset/db_engine_specs/presto.py
b/superset/db_engine_specs/presto.py
index 952574be09..3ff77ab986 100644
--- a/superset/db_engine_specs/presto.py
+++ b/superset/db_engine_specs/presto.py
@@ -906,21 +906,23 @@ class PrestoEngineSpec(BaseEngineSpec): # pylint:
disable=too-many-public-metho
indexes = database.get_indexes(table_name, schema_name)
if indexes:
cols = indexes[0].get("column_names", [])
- full_table_name = table_name
- if schema_name and "." not in table_name:
- full_table_name = "{}.{}".format(schema_name, table_name)
- pql = cls._partition_query(full_table_name, database)
- col_names, latest_parts = cls.latest_partition(
- table_name, schema_name, database, show_first=True
- )
+
+ if cols:
+ full_table_name = table_name
+ if schema_name and "." not in table_name:
+ full_table_name = "{}.{}".format(schema_name, table_name)
+ pql = cls._partition_query(full_table_name, database)
+ col_names, latest_parts = cls.latest_partition(
+ table_name, schema_name, database, show_first=True
+ )
- if not latest_parts:
- latest_parts = tuple([None] * len(col_names))
- metadata["partitions"] = {
- "cols": cols,
- "latest": dict(zip(col_names, latest_parts)),
- "partitionQuery": pql,
- }
+ if not latest_parts:
+ latest_parts = tuple([None] * len(col_names))
+ metadata["partitions"] = {
+ "cols": cols,
+ "latest": dict(zip(col_names, latest_parts)),
+ "partitionQuery": pql,
+ }
# flake8 is not matching `Optional[str]` to `Any` for some reason...
metadata["view"] = cast(