Skip to content
Snippets Groups Projects
Commit c6590e0b authored by Tom Robinson's avatar Tom Robinson
Browse files

Merge branch 'master' of github.com:metabase/metabase into merge-master-to-release-0.33.x

parents badd05bb 978e5091
Branches
Tags
No related merge requests found
(ns metabase.driver.redshift-test
(:require [clojure.test :refer :all]
[metabase.plugins.jdbc-proxy :as jdbc-proxy]
[metabase.test
[fixtures :as fixtures]
[util :as tu]]
......
......@@ -122,6 +122,7 @@
[org.tcrawley/dynapath "1.0.0"] ; Dynamically add Jars (e.g. Oracle or Vertica) to classpath
[org.yaml/snakeyaml "1.23"] ; YAML parser (required by liquibase)
[potemkin "0.4.5"] ; utility macros & fns
[pretty "1.0.1"] ; protocol for defining how custom types should be pretty printed
[prismatic/schema "1.1.11"] ; Data schema declaration and validation library
[puppetlabs/i18n "0.8.0"] ; Internationalization library
[redux "0.1.4"] ; Utility functions for building and composing transducers
......
(ns metabase.driver.util
"Utility functions for common operations on drivers."
(:require [clojure.string :as str]
(:require [clojure.core.memoize :as memoize]
[clojure.string :as str]
[clojure.tools.logging :as log]
[metabase
[config :as config]
......@@ -55,12 +56,16 @@
;;; +----------------------------------------------------------------------------------------------------------------+
(defn- database->driver* [database-or-id]
(db/select-one-field :engine 'Database, :id (u/get-id database-or-id)))
(or
(:engine database-or-id)
(db/select-one-field :engine 'Database, :id (u/get-id database-or-id))))
(def ^{:arglists '([database-or-id])} database->driver
"Memoized function that returns the driver instance that should be used for `Database` with ID. (Databases aren't
expected to change their types, and this optimization makes things a lot faster)."
(memoize database->driver*))
"Look up the driver that should be used for a Database. Lightly cached.
(This is cached for a second, so as to avoid repeated application DB calls if this function is called several times
over the duration of a single API request or sync operation.)"
(memoize/ttl database->driver* :ttl/threshold 1000))
;;; +----------------------------------------------------------------------------------------------------------------+
......@@ -111,7 +116,7 @@
features."
[]
(into {} (for [driver (available-drivers)]
;; TODO - maybe we should rename `connection-properties` -> `connection-properties` on the FE as well?
;; TODO - maybe we should rename `details-fields` -> `connection-properties` on the FE as well?
[driver {:details-fields (driver/connection-properties driver)
:driver-name (driver/display-name driver)
#_:features #_(features driver)}])))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment