Skip to content
Snippets Groups Projects
Unverified Commit 9ed8f3f5 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Merge pull request #9700 from metabase/snowflake-fixes

Update Snowflake JDBC driver version; set CLIENT_SESSION_KEEP_ALIVE
parents 68890f17 118f7811
No related branches found
No related tags found
No related merge requests found
(defproject metabase/snowflake-driver "1.0.0-SNAPSHOT-3.6.20" (defproject metabase/snowflake-driver "1.0.0-SNAPSHOT-3.6.27"
:min-lein-version "2.5.0" :min-lein-version "2.5.0"
:dependencies :dependencies
[[net.snowflake/snowflake-jdbc "3.6.21"]] [[net.snowflake/snowflake-jdbc "3.6.27"]]
:profiles :profiles
{:provided {:provided
......
info: info:
name: Metabase Snowflake Driver name: Metabase Snowflake Driver
version: 1.0.0-SNAPSHOT-3.6.20 version: 1.0.0-SNAPSHOT-3.6.27
description: Allows Metabase to connect to Snowflake databases. description: Allows Metabase to connect to Snowflake databases.
driver: driver:
name: snowflake name: snowflake
...@@ -33,6 +33,7 @@ driver: ...@@ -33,6 +33,7 @@ driver:
- name: role - name: role
display-name: Role display-name: Role
placeholder: my_role placeholder: my_role
- additional-options
connection-properties-include-tunnel-config: true connection-properties-include-tunnel-config: true
init: init:
- step: load-namespace - step: load-namespace
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
[common :as driver.common] [common :as driver.common]
[sql-jdbc :as sql-jdbc]] [sql-jdbc :as sql-jdbc]]
[metabase.driver.sql-jdbc [metabase.driver.sql-jdbc
[common :as sql-jdbc.common]
[connection :as sql-jdbc.conn] [connection :as sql-jdbc.conn]
[execute :as sql-jdbc.execute] [execute :as sql-jdbc.execute]
[sync :as sql-jdbc.sync]] [sync :as sql-jdbc.sync]]
...@@ -39,22 +40,26 @@ ...@@ -39,22 +40,26 @@
account)] account)]
;; it appears to be the case that their JDBC driver ignores `db` -- see my bug report at ;; it appears to be the case that their JDBC driver ignores `db` -- see my bug report at
;; https://support.snowflake.net/s/question/0D50Z00008WTOMCSA5/ ;; https://support.snowflake.net/s/question/0D50Z00008WTOMCSA5/
(merge {:classname "net.snowflake.client.jdbc.SnowflakeDriver" (-> (merge {:classname "net.snowflake.client.jdbc.SnowflakeDriver"
:subprotocol "snowflake" :subprotocol "snowflake"
:subname (str "//" host ".snowflakecomputing.com/") :subname (str "//" host ".snowflakecomputing.com/")
:client_metadata_request_use_connection_ctx true :client_metadata_request_use_connection_ctx true
:ssl true :ssl true
;; other SESSION parameters ;; keep open connections open indefinitely instead of closing them. See #9674 and
;; use the same week start we use for all the other drivers ;; https://docs.snowflake.net/manuals/sql-reference/parameters.html#client-session-keep-alive
:week_start 7 :client_session_keep_alive true
;; not 100% sure why we need to do this but if we don't set the connection to UTC our report timezone ;; other SESSION parameters
;; stuff doesn't work, even though we ultimately override this when we set the session timezone ;; use the same week start we use for all the other drivers
:timezone "UTC"} :week_start 7
(-> opts ;; not 100% sure why we need to do this but if we don't set the connection to UTC our report timezone
;; original version of the Snowflake driver incorrectly used `dbname` in the details fields instead of ;; stuff doesn't work, even though we ultimately override this when we set the session timezone
;; `db`. If we run across `dbname`, correct our behavior :timezone "UTC"}
(set/rename-keys {:dbname :db}) (-> opts
(dissoc :host :port :timezone))))) ;; original version of the Snowflake driver incorrectly used `dbname` in the details fields instead of
;; `db`. If we run across `dbname`, correct our behavior
(set/rename-keys {:dbname :db})
(dissoc :host :port :timezone)))
(sql-jdbc.common/handle-additional-options opts))))
(defmethod sql-jdbc.sync/database-type->base-type :snowflake [_ base-type] (defmethod sql-jdbc.sync/database-type->base-type :snowflake [_ base-type]
({:NUMBER :type/Number ({:NUMBER :type/Number
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment