The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix databricks tests after driver upgrade (#65498)
Riley Thompsonb9f50ff5438a
diff --git a/modules/drivers/databricks/src/metabase/driver/databricks.clj b/modules/drivers/databricks/src/metabase/driver/databricks.cljindex ea5fb03f780..8527893d2da 100644--- a/modules/drivers/databricks/src/metabase/driver/databricks.clj+++ b/modules/drivers/databricks/src/metabase/driver/databricks.clj@@ -27,7 +27,8 @@PreparedStatementResultSetResultSetMetaData- Statement]+ Statement+ Types][java.timeLocalDateLocalDateTime@@ -501,3 +502,12 @@(defmethod sql-jdbc/impl-table-known-to-not-exist? :databricks[_ e](= (sql-jdbc/get-sql-state e) "42P01"))++(defmethod sql-jdbc.execute/read-column-thunk [:databricks Types/ARRAY]+ [_driver ^java.sql.ResultSet rs _rsmeta ^Integer i]+ ;; This differs from the sql-jdbc implementation due to a change in+ ;; Databricks' JDBC driver from 2.7.3 to 3.0.1. It returns the type+ ;; of an array column as Types/ARRAY now, but the object is a+ ;; java.lang.String, so we can't call .getArray on it and instead+ ;; should return it as is.+ (fn [] (.getObject rs i)))diff --git a/modules/drivers/databricks/test/metabase/driver/databricks_test.clj b/modules/drivers/databricks/test/metabase/driver/databricks_test.cljindex e70a3e6aee0..8c397eabc56 100644--- a/modules/drivers/databricks/test/metabase/driver/databricks_test.clj+++ b/modules/drivers/databricks/test/metabase/driver/databricks_test.clj@@ -264,14 +264,8 @@(testing "Connections with UserAgentEntry"(sql-jdbc.conn/with-connection-spec-for-testing-connection[spec [:databricks (:details (mt/db))]]- (is (= [{:a 1}] (jdbc/query spec ["select 1 as a"]))))- (with-redefs [config/mb-version-info {:tag "invalid agent"}]- (sql-jdbc.conn/with-connection-spec-for-testing-connection- [spec [:databricks (:details (mt/db))]]- (is (thrown-with-msg?- Exception- #"Incorrect format for User-Agent entry"- (jdbc/query spec ["select 1 as a"]))))))+ (is (= (str "Metabase/" (:tag config/mb-version-info)) (:UserAgentEntry spec)))+ (is (= [{:a 1}] (jdbc/query spec ["select 1 as a"])))))(testing "Additional options are added to :subname key of generated spec"(is (re-find #";IgnoreTransactions=0$"(->> {:http-path "p/a/t/h",diff --git a/test/metabase/query_processor/api_test.clj b/test/metabase/query_processor/api_test.cljindex 302e73d7435..5ccfa2b57a1 100644--- a/test/metabase/query_processor/api_test.clj+++ b/test/metabase/query_processor/api_test.clj@@ -668,7 +668,7 @@"asdf;"))](is (= {:error_type "invalid-query":status "failed"- :class "class com.databricks.client.support.exceptions.ErrorException"}+ :class "class com.databricks.jdbc.exception.DatabricksSQLException"}(select-keys res [:error_type :status :class])))(is (not (str/includes? (:error res) "\n\tat ")))))))