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
Allow syncing timestamp_ntz columns in databricks (#67140)
Riley Thompson4586ae1efc7b
diff --git a/modules/drivers/databricks/src/metabase/driver/databricks.clj b/modules/drivers/databricks/src/metabase/driver/databricks.cljindex 9464c49ba52..45f9a6f9c40 100644--- a/modules/drivers/databricks/src/metabase/driver/databricks.clj+++ b/modules/drivers/databricks/src/metabase/driver/databricks.clj@@ -193,10 +193,6 @@[:= :c.column_name :cs.column_name]]]:where [:and(when-not multi-level-schema [:= :c.table_catalog catalog])- ;; Ignore `timestamp_ntz` type columns. Columns of this type are not recognizable from- ;; `timestamp` columns when fetching the data. This exception should be removed when the problem- ;; is resolved by Databricks in underlying jdbc driver.- [:not= :c.full_data_type [:inline "timestamp_ntz"]][:not [:startswith :c.table_catalog [:inline "__databricks"]]][:not [:in :c.table_schema [[:inline "information_schema"]]]](schema-names-filter schema-names multi-level-schema :c.table_catalog :c.table_schema)diff --git a/modules/drivers/databricks/test/metabase/driver/databricks_test.clj b/modules/drivers/databricks/test/metabase/driver/databricks_test.cljindex d234346012c..13b0b6023c5 100644--- a/modules/drivers/databricks/test/metabase/driver/databricks_test.clj+++ b/modules/drivers/databricks/test/metabase/driver/databricks_test.clj@@ -177,10 +177,20 @@:databricks(mt/datasetdataset-with-ntz- (testing "timestamp column was ignored during sync"- (let [columns (t2/select :model/Field :table_id (t2/select-one-fn :id :model/Table :db_id (mt/id)))]- (is (= 1 (count columns)))- (is (= "id" (:name (first columns)))))))))+ (testing "timestamp_ntz column is synced with correct types"+ (let [columns (t2/select :model/Field :table_id (t2/select-one-fn :id :model/Table :db_id (mt/id)))+ col-type-info (into {}+ (map (fn [col]+ [(:name col)+ (select-keys col [:base_type :effective_type :database_type])]))+ columns)]+ (is (= {"id" {:base_type :type/Integer+ :effective_type :type/Integer+ :database_type "int"}+ "timestamp" {:base_type :type/DateTime+ :effective_type :type/DateTime+ :database_type "timestamp_ntz"}}+ col-type-info)))))))(deftest ^:parallel db-default-timezone-test(mt/test-driver