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

Setting adjust_database_uri for HiveEngineSpec #2636

Merged
merged 2 commits into from
Apr 18, 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
6 changes: 6 additions & 0 deletions superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions tests/model_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def test_database_schema_postgres(self):
self.assertEquals('prod', db)

def test_database_schema_hive(self):
sqlalchemy_uri = 'hive://[email protected]:10000/hive/default'
sqlalchemy_uri = 'hive://[email protected]: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'
Expand Down