This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 2c5201fa4b fix: Databricks views showing up as tables (#20674)
2c5201fa4b is described below

commit 2c5201fa4bf31091d4fe4ce31f81b4a354f0cbfe
Author: Beto Dealmeida <[email protected]>
AuthorDate: Wed Jul 20 09:31:42 2022 -0700

    fix: Databricks views showing up as tables (#20674)
---
 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 9bb0085754..79718c93f6 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 @@ class DatabricksNativeEngineSpec(DatabricksODBCEngineSpec):
         }
         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)

Reply via email to