diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 2d6d28d7e9ca4..99d182eb7339f 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -650,6 +650,12 @@ def fetch_result_sets(cls, db, datasource_type, force=False): return BaseEngineSpec.fetch_result_sets( db, datasource_type, force=force) + @classmethod + def adjust_database_uri(cls, uri, selected_schema=None): + if selected_schema: + uri.database = selected_schema + return uri + @classmethod def progress(cls, logs): # 17/02/07 19:36:38 INFO ql.Driver: Total jobs = 5 diff --git a/tests/model_tests.py b/tests/model_tests.py index dc826a2875145..df2902b107b62 100644 --- a/tests/model_tests.py +++ b/tests/model_tests.py @@ -37,13 +37,13 @@ def test_database_schema_postgres(self): self.assertEquals('prod', db) def test_database_schema_hive(self): - sqlalchemy_uri = 'hive://hive@hive.airbnb.io:10000/hive/default' + sqlalchemy_uri = 'hive://hive@hive.airbnb.io:10000/default?auth=NOSASL' model = Database(sqlalchemy_uri=sqlalchemy_uri) db = make_url(model.get_sqla_engine().url).database - self.assertEquals('hive/default', db) + self.assertEquals('default', db) db = make_url(model.get_sqla_engine(schema='core_db').url).database - self.assertEquals('hive/core_db', db) + self.assertEquals('core_db', db) def test_database_schema_mysql(self): sqlalchemy_uri = 'mysql://root@localhost/superset'