Skip to content

Commit

Permalink
Get 'Test Connection' button to take 'engine_params' into account (ap…
Browse files Browse the repository at this point in the history
…ache#5830)

(cherry picked from commit 4a62ef3)
  • Loading branch information
mistercrunch committed Sep 19, 2018
1 parent e3438fe commit 29bad3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion superset/templates/superset/models/database/macros.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% macro testconn() %}
<script>
$("#sqlalchemy_uri").parent()
.append('<button id="testconn" class="btn">{{ _("Test Connection") }}</button>');
.append('<button id="testconn" class="btn btn-sm btn-primary">{{ _("Test Connection") }}</button>');
$("#testconn").click(function(e) {
e.preventDefault();
var url = "/superset/testconn";
Expand Down
8 changes: 4 additions & 4 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,16 +1703,16 @@ def testconn(self):
username),
)

connect_args = (
engine_params = (
request.json
.get('extras', {})
.get('engine_params', {})
.get('connect_args', {}))
.get('engine_params', {}))
connect_args = engine_params.get('connect_args')

if configuration:
connect_args['configuration'] = configuration

engine = create_engine(uri, connect_args=connect_args)
engine = create_engine(uri, **engine_params)
engine.connect()
return json_success(json.dumps(engine.table_names(), indent=4))
except Exception as e:
Expand Down

0 comments on commit 29bad3c

Please sign in to comment.