From 5f5d576e0290b5edec07423c244b0d37c65b1105 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 18 Apr 2017 01:13:46 +0000 Subject: [PATCH 1/2] Setting adjust_database_uri for HiveEngineSpec --- superset/db_engine_specs.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 From 867b7d2e2d6b12e1f6ecb15da322413a08f0dd52 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 17 Apr 2017 19:17:32 -0700 Subject: [PATCH 2/2] fix tests --- tests/model_tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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'