You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/11/21 17:28:34 UTC
[incubator-superset] branch master updated: fix the schema-fetching
problem for impala in sql_lab (#3906)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin 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 feb15a3 fix the schema-fetching problem for impala in sql_lab (#3906)
feb15a3 is described below
commit feb15a30a286943d597f2e710a4a8193125ab5a3
Author: Yu Xiao <xi...@gmail.com>
AuthorDate: Wed Nov 22 02:28:31 2017 +0900
fix the schema-fetching problem for impala in sql_lab (#3906)
* fix the schema-fetching problem for impala in sql_lab
* delete redundant print
* remove blank lines...
* minior corrections
---
superset/db_engine_specs.py | 10 ++++++++++
superset/models/core.py | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index 4b66fa1..37464e4 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -149,6 +149,10 @@ class BaseEngineSpec(object):
pass
@classmethod
+ def get_schema_names(cls, inspector):
+ return inspector.get_schema_names()
+
+ @classmethod
def get_table_names(cls, schema, inspector):
return sorted(inspector.get_table_names(schema))
@@ -1092,6 +1096,12 @@ class ImpalaEngineSpec(BaseEngineSpec):
return "{}'".format(dttm.strftime('%Y-%m-%d'))
return "'{}'".format(dttm.strftime('%Y-%m-%d %H:%M:%S'))
+ @classmethod
+ def get_schema_names(cls, inspector):
+ schemas = [row[0] for row in inspector.engine.execute('SHOW SCHEMAS')
+ if not row[0].startswith('_')]
+ return schemas
+
engines = {
o.engine: o for o in globals().values()
diff --git a/superset/models/core.py b/superset/models/core.py
index d2989d5..2996625 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -726,7 +726,7 @@ class Database(Model, AuditMixinNullable):
return views
def all_schema_names(self):
- return sorted(self.inspector.get_schema_names())
+ return sorted(self.db_engine_spec.get_schema_names(self.inspector))
@property
def db_engine_spec(self):
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].