Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the schema-fetching problem for impala in sql_lab #3906

Merged
merged 4 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions superset/db_engine_specs.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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