diff --git a/project.clj b/project.clj index 7ec1f23021a4fd7b3e2362790405c4a3436b990b..340d44bbe548f2c49b3574fb9f53af3e9c9baf37 100644 --- a/project.clj +++ b/project.clj @@ -91,8 +91,10 @@ [ring/ring-json "0.4.0"] ; Ring middleware for reading/writing JSON automatically [stencil "0.5.0"] ; Mustache templates for Clojure [toucan "1.0.3" ; Model layer, hydration, and DB utilities - :exclusions [honeysql]]] - :repositories [["bintray" "https://dl.bintray.com/crate/crate"]] ; Repo for Crate JDBC driver + :exclusions [honeysql]] + [com.amazon.redshift/redshift-jdbc41 "1.2.8.1005"]] ; Redshift JDBC driver + :repositories [["bintray" "https://dl.bintray.com/crate/crate"] + ["redshift" "http://redshift-maven-repository.s3-website-us-east-1.amazonaws.com/release"]] ; Repo for Crate JDBC driver :plugins [[lein-environ "1.1.0"] ; easy access to environment variables [lein-ring "0.11.0" ; start the HTTP server with 'lein ring server' :exclusions [org.clojure/clojure]]] ; TODO - should this be a dev dependency ? diff --git a/src/metabase/db/spec.clj b/src/metabase/db/spec.clj index 3b7454c891e447494a631bfe51742e9f8cb3720c..057c82c7f3e6b2de5723104f8383c7661ebc5c2f 100644 --- a/src/metabase/db/spec.clj +++ b/src/metabase/db/spec.clj @@ -38,3 +38,15 @@ :subname (str "//" host ":" port "/" db) :delimiters "`"} (dissoc opts :host :port :db))) + +(defn redshift + "Create a database specification for a redshift database. Opts should include + keys for :db, :user, and :password. You can also optionally set host and + port." + [{:keys [host port db] + :as opts}] + (merge {:classname "com.amazon.redshift.jdbc.Driver" ; must be in classpath + :subprotocol "redshift" + :subname (str "//" host ":" port "/" db) + :ssl true} + (dissoc opts :host :port :db))) diff --git a/src/metabase/driver/redshift.clj b/src/metabase/driver/redshift.clj index 472360d5344774b09c95fdccfec7ed5c353aa867..8c25b1524d1413a49e1783a30b472b5dbe62b525 100644 --- a/src/metabase/driver/redshift.clj +++ b/src/metabase/driver/redshift.clj @@ -16,7 +16,7 @@ [ssh :as ssh]])) (defn- connection-details->spec [details] - (dbspec/postgres (merge details postgres/ssl-params))) ; always connect to redshift over SSL + (dbspec/redshift details)) (defn- date-interval [unit amount] (hsql/call :+ :%getdate (hsql/raw (format "INTERVAL '%d %s'" (int amount) (name unit)))))