Skip to content

Commit

Permalink
Include connection parameters in call to Test Connection for a new da…
Browse files Browse the repository at this point in the history
…tabase (#326)
  • Loading branch information
Denis Zgonjanin authored and mistercrunch committed Apr 11, 2016
1 parent 9ac979a commit 6d0b576
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -111,7 +111,7 @@ export PATH="$HOME/.node/bin:$PATH"

#### npm packages
To install third party libraries defined in `package.json`, run the
following within this directory which will install them in a
following within the `caravel/assets/` directory which will install them in a
new `node_modules/` folder within `assets/`.

```
Expand Down
5 changes: 3 additions & 2 deletions caravel/templates/caravel/models/database/macros.html
Expand Up @@ -7,8 +7,9 @@
$.ajax({
method: "POST",
url: url,
data: { uri: $("#sqlalchemy_uri").val() },
dataType: 'json'
data: JSON.stringify({ uri: $("#sqlalchemy_uri").val(), extras: JSON.parse($("#extra").val()) }),
dataType: 'json',
contentType: "application/json; charset=utf-8"
}).done(function(data) {
alert("Seems OK!");
if ($('#tables').length == 0)
Expand Down
5 changes: 3 additions & 2 deletions caravel/views.py
Expand Up @@ -629,8 +629,9 @@ def save_dash(self, dashboard_id):
def testconn(self):
"""Tests a sqla connection"""
try:
uri = request.form.get('uri')
engine = create_engine(uri)
uri = request.json.get('uri')
connect_args = request.json.get('extras', {}).get('engine_params', {}).get('connect_args')
engine = create_engine(uri, connect_args=connect_args)
engine.connect()
return json.dumps(engine.table_names(), indent=4)
except Exception:
Expand Down

0 comments on commit 6d0b576

Please sign in to comment.