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
b033197e
Unverified
Commit
b033197e
authored
6 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
Don't run date-bucketing tests for Snowflake; fix fetching timezone
parent
df3cad62
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver.clj
+8
-4
8 additions, 4 deletions
src/metabase/driver.clj
test/metabase/query_processor_test/date_bucketing_test.clj
+21
-21
21 additions, 21 deletions
test/metabase/query_processor_test/date_bucketing_test.clj
with
29 additions
and
25 deletions
src/metabase/driver.clj
+
8
−
4
View file @
b033197e
...
...
@@ -22,6 +22,7 @@
[
metabase.models
[
database
:refer
[
Database
]]
[
setting
:refer
[
defsetting
]]]
[
metabase.query-processor.store
:as
qp.store
]
[
metabase.sync.interface
:as
si
]
[
metabase.util
[
date
:as
du
]
...
...
@@ -407,13 +408,16 @@
parses the date returned preserving it's timezone"
[
native-query
date-formatters
]
(
fn
[
driver
database
]
{
:pre
[(
map?
database
)]}
(
let
[
settings
(
when-let
[
report-tz
(
report-timezone-if-supported
driver
)]
{
:settings
{
:report-timezone
report-tz
}})
time-str
(
try
(
->>
(
merge
settings
{
:database
database,
:native
{
:query
native-query
}})
(
execute-query
driver
)
:rows
ffirst
)
(
qp.store/with-store
(
qp.store/store-database!
database
)
(
->>
(
merge
settings
{
:database
database,
:native
{
:query
native-query
}})
(
execute-query
driver
)
:rows
ffirst
))
(
catch
Exception
e
(
throw
(
Exception.
...
...
This diff is collapsed.
Click to expand it.
test/metabase/query_processor_test/date_bucketing_test.clj
+
21
−
21
View file @
b033197e
...
...
@@ -810,29 +810,29 @@
(
cons
:relative-datetime
relative-datetime-args
)]}))
first-row
first
int
))
;; HACK - Don't run these tests against BigQuery because the databases need to be loaded every time the tests are ran
;; and loading data into BigQuery is mind-bogglingly slow. Don't worry, I promise these work though!
;; HACK - Don't run these tests against BigQuery
/etc.
because the databases need to be loaded every time the tests are ran
;; and loading data into BigQuery
/etc.
is mind-bogglingly slow. Don't worry, I promise these work though!
;; Don't run the minute tests against Oracle because the Oracle tests are kind of slow and case CI to fail randomly
;; when it takes so long to load the data that the times are no longer current (these tests pass locally if your
;; machine isn't as slow as the CircleCI ones)
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
-1
"minute"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
1
"minute"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
-1
"minute"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
:oracle
}
4
(
count-of-grouping
(
checkins
:4-per-minute
)
:minute
1
"minute"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
-1
"hour"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
1
"hour"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
-1
"hour"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
4
(
count-of-grouping
(
checkins
:4-per-hour
)
:hour
1
"hour"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
-1
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
1
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
-1
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
1
(
count-of-grouping
(
checkins
:1-per-day
)
:day
1
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
7
(
count-of-grouping
(
checkins
:1-per-day
)
:week
"current"
))
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
7
(
count-of-grouping
(
checkins
:1-per-day
)
:week
"current"
))
;; SYNTACTIC SUGAR
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
1
(
->
(
data/with-temp-db
[
_
(
checkins
:1-per-day
)]
(
data/run-mbql-query
checkins
...
...
@@ -840,7 +840,7 @@
:filter
[
:time-interval
$timestamp
:current
:day
]}))
first-row
first
int
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
7
(
->
(
data/with-temp-db
[
_
(
checkins
:1-per-day
)]
(
data/run-mbql-query
checkins
...
...
@@ -862,32 +862,32 @@
(
throw
(
ex-info
"Query failed!"
results
)))
:unit
(
->
results
:data
:cols
first
:unit
)}))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
1
,
:unit
:day
}
(
date-bucketing-unit-when-you
:breakout-by
"day"
,
:filter-by
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
7
,
:unit
:day
}
(
date-bucketing-unit-when-you
:breakout-by
"day"
,
:filter-by
"week"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
1
,
:unit
:week
}
(
date-bucketing-unit-when-you
:breakout-by
"week"
,
:filter-by
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
1
,
:unit
:quarter
}
(
date-bucketing-unit-when-you
:breakout-by
"quarter"
,
:filter-by
"day"
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
1
,
:unit
:hour
}
(
date-bucketing-unit-when-you
:breakout-by
"hour"
,
:filter-by
"day"
))
;; make sure if you use a relative date bucket in the past (e.g. "past 2 months") you get the correct amount of rows
;; (#3910)
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
2
,
:unit
:day
}
(
date-bucketing-unit-when-you
:breakout-by
"day"
,
:filter-by
"day"
,
:with-interval
-2
))
(
expect-with-non-timeseries-dbs-except
#
{
:bigquery
}
(
expect-with-non-timeseries-dbs-except
#
{
:snowflake
:bigquery
}
{
:rows
2
,
:unit
:day
}
(
date-bucketing-unit-when-you
:breakout-by
"day"
,
:filter-by
"day"
,
:with-interval
2
))
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