diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 4b66fa1c33ae..37464e41baa5 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -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)) @@ -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() diff --git a/superset/models/core.py b/superset/models/core.py index d2989d535e32..2996625e2cbf 100644 --- a/superset/models/core.py +++ b/superset/models/core.py @@ -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):