Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
431763b7
Commit
431763b7
authored
6 years ago
by
Ryan Senior
Browse files
Options
Downloads
Patches
Plain Diff
Fix a Time field test issue on Snowflake [ci drivers]
parent
9f5f81a3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/snowflake.clj
+6
-2
6 additions, 2 deletions
src/metabase/driver/snowflake.clj
test/metabase/query_processor_test/time_field_test.clj
+6
-0
6 additions, 0 deletions
test/metabase/query_processor_test/time_field_test.clj
with
12 additions
and
2 deletions
src/metabase/driver/snowflake.clj
+
6
−
2
View file @
431763b7
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
test/metabase/query_processor_test/time_field_test.clj
+
6
−
0
View file @
431763b7
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment