diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 8ab5c071d..79ef886a0 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -1433,6 +1433,28 @@ class BQEngineSpec(BaseEngineSpec): '128 characters'.format(mutated_label)) return mutated_label + @classmethod + def extra_table_metadata(cls, database, table_name, schema_name): + indexes = database.get_indexes(table_name, schema_name) + if not indexes: + return {} + partitions_columns = [ + index.get('column_names', []) for index in indexes + if index.get('name') == 'partition' + ] + cluster_columns = [ + index.get('column_names', []) for index in indexes + if index.get('name') == 'clustering' + ] + return { + 'partitions': { + 'cols': partitions_columns, + }, + 'clustering': { + 'cols': cluster_columns, + }, + } + @classmethod def _get_fields(cls, cols): """