Skip to content

Commit

Permalink
Set default database when connecting to Materialize (#4)
Browse files Browse the repository at this point in the history
Adds a default `materialize` database to the default connection string.
  • Loading branch information
JLDLaughlin authored Feb 4, 2020
2 parents 53aef03 + 2b2fd43 commit a7771f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Binary file modified images/materialize-metabase.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion resources/metabase-plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ driver:
connection-properties:
- merge:
- host
- default: localhost
- default: materialized
- merge:
- port
- default: 6875
- merge:
- dbname
- default: materialize
- merge:
- user
- default: default
Expand Down
6 changes: 3 additions & 3 deletions src/metabase/driver/materialize.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
; ;;; +----------------------------------------------------------------------------------------------------------------+

(defn- make-subname [host port db]
(str "//" host ":" port "/"))
(str "//" host ":" port "/" db))

(defn materialize
"Create a Clojure JDBC database specification for Materialize."
[{:keys [host port db]
:or {host "localhost", port 6875, db ""}
:or {host "localhost", port 6875, db "materialize"}
:as opts}]
(merge
{:classname "io.materialize.Driver"
:subprotocol "materialize"
:subname (make-subname host (or port 6875) db)}
:subname (make-subname host port db)}
(dissoc opts :host :port :db)))


Expand Down

0 comments on commit a7771f6

Please sign in to comment.