Skip to content
Snippets Groups Projects
Commit 431763b7 authored by Ryan Senior's avatar Ryan Senior
Browse files

Fix a Time field test issue on Snowflake [ci drivers]

parent 9f5f81a3
No related branches found
No related tags found
No related merge requests found
......@@ -14,8 +14,8 @@
[metabase.util
[honeysql-extensions :as hx]
[ssh :as ssh]]
[toucan.db :as db]
[clojure.java.jdbc :as jdbc]))
[toucan.db :as db])
(:import java.sql.Time))
(defn- connection-details->spec
"Create a database specification for a snowflake database."
......@@ -141,6 +141,10 @@
(let [{table-name :name, schema :schema} table]
(hx/qualify-and-escape-dots (query-db-name) schema table-name)))
(defmethod sql.qp/->honeysql [SnowflakeDriver :time]
[driver [_ value unit]]
(hx/->time (sql.qp/->honeysql driver value)))
(defn- field->identifier
"Generate appropriate identifier for a Field for SQL parameters. (NOTE: THIS IS ONLY USED FOR SQL PARAMETERS!)"
;; TODO - Making a DB call for each field to fetch its Table is inefficient and makes me cry, but this method is
......
......@@ -79,6 +79,12 @@
(= :mysql *engine*)
[]
;; It looks like Snowflake is doing this conversion correctly. Snowflake's time field is stored as wall clock time
;; (vs. PG and others storing it without a timezone). Originally, this time is 16:15 in UTC, which is 8:15 in
;; pacific time. The other report timezone databases are not doing this timezone conversion.
(= :snowflake *engine*)
[[3 "Kaneonuskatew Eiran" "08:15:00.000-08:00"]]
;; Databases like PostgreSQL ignore timezone information when
;; using a time field, the result below is what happens when the
;; 08:00 time is interpreted as UTC, then not adjusted to Pacific
......
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