Skip to content

Commit

Permalink
fix the schema-fetching problem for impala in sql_lab (apache#3906)
Browse files Browse the repository at this point in the history
* fix the schema-fetching problem for impala in sql_lab

* delete redundant print

* remove blank lines...

* minior corrections
  • Loading branch information
xiaoyugit authored and mistercrunch committed Nov 21, 2017
1 parent b72321e commit e9b2758
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions superset/db_engine_specs.py
Expand Up @@ -148,6 +148,10 @@ def adjust_database_uri(cls, uri, selected_schema):
def patch(cls):
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))
Expand Down Expand Up @@ -1092,6 +1096,12 @@ def convert_dttm(cls, target_type, dttm):
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()
Expand Down
2 changes: 1 addition & 1 deletion superset/models/core.py
Expand Up @@ -726,7 +726,7 @@ def all_view_names(self, schema=None, force=False):
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):
Expand Down

0 comments on commit e9b2758

Please sign in to comment.