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
f063a349
Commit
f063a349
authored
8 years ago
by
Cam Saül
Browse files
Options
Downloads
Patches
Plain Diff
More BigQuery CI tweaks
parent
bc99be45
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/bigquery.clj
+15
-10
15 additions, 10 deletions
src/metabase/driver/bigquery.clj
test/metabase/test/data/bigquery.clj
+4
-4
4 additions, 4 deletions
test/metabase/test/data/bigquery.clj
with
19 additions
and
14 deletions
src/metabase/driver/bigquery.clj
+
15
−
10
View file @
f063a349
...
...
@@ -33,20 +33,25 @@
(
def
^
:private
^
:const
^
String
redirect-uri
"urn:ietf:wg:oauth:2.0:oob"
)
(
defn-
execute-no-auto-retry
"`execute` REQUEST, and catch any `GoogleJsonResponseException` is
throws, converting them to `ExceptionInfo` and rethrowing them."
[
^
AbstractGoogleClientRequest
request
]
(
try
(
.execute
request
)
(
catch
GoogleJsonResponseException
e
(
let
[
^
GoogleJsonError
error
(
.getDetails
e
)]
(
throw
(
ex-info
(
or
(
.getMessage
error
)
(
.getStatusMessage
e
))
(
into
{}
error
)))))))
(
defn-
execute
"`execute` REQUEST, and catch any `GoogleJsonResponseException` is
throws, converting them to `ExceptionInfo` and rethrowing them.
This automatically retries any failed requests
a single
time."
This automatically retries any failed requests
up to 2
time
s
."
[
^
AbstractGoogleClientRequest
request
]
;; automatically retry each request at least once if it fails
(
u/auto-retry
1
(
try
(
.execute
request
)
(
catch
GoogleJsonResponseException
e
(
let
[
^
GoogleJsonError
error
(
.getDetails
e
)]
(
throw
(
ex-info
(
or
(
.getMessage
error
)
(
.getStatusMessage
e
))
(
into
{}
error
))))))))
(
u/auto-retry
2
(
execute-no-auto-retry
request
)))
(
defn-
^
Bigquery
credential->client
[
^
GoogleCredential
credential
]
(
.build
(
doto
(
Bigquery$Builder.
http-transport
json-factory
credential
)
...
...
@@ -185,7 +190,7 @@
"STRING"
identity
"TIMESTAMP"
parse-timestamp-str
})
(
def
^
:private
^
:const
query-default-timeout-seconds
15
)
(
def
^
:private
^
:const
query-default-timeout-seconds
30
)
(
defn-
post-process-native
([
^
QueryResponse
response
]
...
...
This diff is collapsed.
Click to expand it.
test/metabase/test/data/bigquery.clj
+
4
−
4
View file @
f063a349
...
...
@@ -14,7 +14,7 @@
(
com.google.api.services.bigquery.model
Dataset
DatasetReference
QueryRequest
Table
TableDataInsertAllRequest
TableDataInsertAllRequest$Rows
TableFieldSchema
TableReference
TableRow
TableSchema
)
metabase.driver.bigquery.BigQueryDriver
))
(
resolve-private-fns
metabase.driver.bigquery
execute
post-process-native
)
(
resolve-private-fns
metabase.driver.bigquery
execute
execute-no-auto-retry
post-process-native
)
;;; # ------------------------------------------------------------ CONNECTION DETAILS ------------------------------------------------------------
...
...
@@ -67,8 +67,8 @@
(
defn-
destroy-dataset!
[
^
String
dataset-id
]
{
:pre
[(
seq
dataset-id
)]}
(
execute
(
doto
(
.delete
(
.datasets
bigquery
)
project-id
dataset-id
)
(
.setDeleteContents
true
)))
(
execute
-no-auto-retry
(
doto
(
.delete
(
.datasets
bigquery
)
project-id
dataset-id
)
(
.setDeleteContents
true
)))
(
println
(
u/format-color
'red
"Deleted BigQuery dataset '%s'."
dataset-id
)))
(
def
^
:private
^
:const
valid-field-types
...
...
@@ -179,7 +179,7 @@
{
:pre
[(
seq
database-name
)
(
sequential?
table-definitions
)]}
(
let
[
database-name
(
normalize-name-and-add-prefix
database-name
)]
(
when-not
(
contains?
@
created-databases
database-name
)
(
u/auto-retry
2
(
u/auto-retry
3
(
u/ignore-exceptions
(
destroy-dataset!
database-name
))
(
create-dataset!
database-name
)
...
...
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