superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [incubator-superset] branch master updated: override get_view_names in PrestoEngineSpec (#6459)
Date Wed, 28 Nov 2018 23:13:45 GMT
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/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new f1cae2e  override get_view_names in PrestoEngineSpec (#6459)
f1cae2e is described below

commit f1cae2ecdd57686d23a5ff21b353a487d408dd74
Author: Junda Yang <youngyjd@gmail.com>
AuthorDate: Wed Nov 28 15:13:38 2018 -0800

    override get_view_names in PrestoEngineSpec (#6459)
    
    * override get_view_names in PrestoEngineSpec
    
    * add test
    
    * flake 8
    
    * flake 8
---
 superset/db_engine_specs.py   | 10 ++++++++++
 tests/db_engine_specs_test.py |  8 ++++++++
 2 files changed, 18 insertions(+)

diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 19f55ea..5722507 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -687,6 +687,16 @@ class PrestoEngineSpec(BaseEngineSpec):
     }
 
     @classmethod
+    def get_view_names(cls, inspector, schema):
+        """Returns an empty list
+
+        get_table_names() function returns all table names and view names,
+        and get_view_names() is not implemented in sqlalchemy_presto.py
+        https://github.com/dropbox/PyHive/blob/e25fc8440a0686bbb7a5db5de7cb1a77bdb4167a/pyhive/sqlalchemy_presto.py
+        """
+        return []
+
+    @classmethod
     def adjust_database_uri(cls, uri, selected_schema=None):
         database = uri.database
         if selected_schema and database:
diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py
index b72052f..bdee22a 100644
--- a/tests/db_engine_specs_test.py
+++ b/tests/db_engine_specs_test.py
@@ -1,5 +1,7 @@
 import inspect
 
+import mock
+
 from superset import db_engine_specs
 from superset.db_engine_specs import (
     BaseEngineSpec, HiveEngineSpec, MssqlEngineSpec,
@@ -284,3 +286,9 @@ class DbEngineSpecsTestCase(SupersetTestCase):
                 defined_time_grains = {grain.duration for grain in cls.get_time_grains()}
                 intersection = time_grains.intersection(defined_time_grains)
                 self.assertSetEqual(defined_time_grains, intersection, cls_name)
+
+    def test_presto_get_view_names_return_empty_list(self):
+        self.assertEquals([], PrestoEngineSpec.get_view_names(mock.ANY, mock.ANY))
+
+    def test_hive_get_view_names_return_empty_list(self):
+        self.assertEquals([], HiveEngineSpec.get_view_names(mock.ANY, mock.ANY))


Mime
View raw message