Skip to content
Snippets Groups Projects
Unverified Commit c7b2fd5c authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan Committed by GitHub
Browse files

Allow JDBC additional-options in Redshift plugin (#18111)

parent 465480d3
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,9 @@ driver:
placeholder: toucan_sightings
- user
- password
- merge:
- additional-options
- placeholder: 'SocketTimeout=0'
connection-properties-include-tunnel-config: true
init:
- step: load-namespace
......
......@@ -207,10 +207,10 @@
(merge
{:classname "com.amazon.redshift.jdbc42.Driver"
:subprotocol "redshift"
:subname (str "//" host ":" port "/" db)
:subname (str "//" host ":" port "/" db
"?defaultRowFetchSize=" (pubset/redshift-fetch-size))
:ssl true
:OpenSourceSubProtocolOverride false
:additional-options (str "defaultRowFetchSize=" (pubset/redshift-fetch-size))}
:OpenSourceSubProtocolOverride false}
(dissoc opts :host :port :db))))
(prefer-method
......
......@@ -295,3 +295,31 @@
(is (contains? (schemas) fake-schema-name))))
(testing "normally, ::fake-schema should be filtered out (because it does not exist)"
(is (not (contains? (schemas) fake-schema-name)))))))))))))
(deftest connection-details->spec-test
(mt/with-temporary-setting-values [redshift-fetch-size "14"]
(testing "Configure connection without additional-options should include defaultRowFetchSize"
(is (= {:classname "com.amazon.redshift.jdbc42.Driver"
:subprotocol "redshift"
:subname "//testhost:5432/testdb?defaultRowFetchSize=14"
:OpenSourceSubProtocolOverride false
:user "testuser"
:ssl true}
(sql-jdbc.conn/connection-details->spec :redshift
{:host "testhost"
:port 5432
:db "testdb"
:user "testuser"}))))
(testing "Configure connection with additional-options should not replace defaultRowFetchSize"
(is (= {:classname "com.amazon.redshift.jdbc42.Driver"
:subprotocol "redshift"
:subname "//testhost:5432/testdb?defaultRowFetchSize=14&TCPKeepAlive=FALSE"
:OpenSourceSubProtocolOverride false
:user "testuser"
:ssl true}
(sql-jdbc.conn/connection-details->spec :redshift
{:host "testhost"
:port 5432
:db "testdb"
:user "testuser"
:additional-options "TCPKeepAlive=FALSE"}))))))
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