From ff3749f03f455f90baf0290b2898366027ef9b85 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Mon, 11 Jul 2022 12:36:54 -0700 Subject: [PATCH] fix: Databricks views showing up as tables --- superset/db_engine_specs/databricks.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/superset/db_engine_specs/databricks.py b/superset/db_engine_specs/databricks.py index 9bb00857544c1..79718c93f664c 100644 --- a/superset/db_engine_specs/databricks.py +++ b/superset/db_engine_specs/databricks.py @@ -16,7 +16,9 @@ # under the License. from datetime import datetime -from typing import Any, Dict, Optional, TYPE_CHECKING +from typing import Any, Dict, List, Optional, TYPE_CHECKING + +from sqlalchemy.engine.reflection import Inspector from superset.constants import USER_AGENT from superset.db_engine_specs.base import BaseEngineSpec @@ -87,3 +89,16 @@ def get_extra_params(database: "Database") -> Dict[str, Any]: } extra.update(BaseEngineSpec.get_extra_params(database)) return extra + + @classmethod + def get_table_names( + cls, + database: "Database", + inspector: Inspector, + schema: Optional[str], + ) -> List[str]: + tables = set(super().get_table_names(database, inspector, schema)) + views = set(cls.get_view_names(database, inspector, schema)) + actual_tables = tables - views + + return list(actual_tables)