Skip to content
Snippets Groups Projects
Unverified Commit b85227d2 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Merge 0.36.8.2 -> release-x.37.x (#13599)


* Specify location on getQueryResults calls (#13592)

You must specify the location on any getQueryResults calls to BigQuery.
It's supposed to be optional for anything but EU and US regions, but
useast1 seems to require it.

Fixes #13582

[ci bigquery]

* v0.36.8.2

Co-authored-by: default avatarRobert Roland <rob@metabase.com>
parent 4953ab85
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION='v1.37.0' VERSION='v0.37.0'
# dynamically pull more interesting stuff from latest git commit # dynamically pull more interesting stuff from latest git commit
HASH=$(git show-ref --head --hash=7 head) # first 7 letters of hash should be enough; that's what GitHub uses HASH=$(git show-ref --head --hash=7 head) # first 7 letters of hash should be enough; that's what GitHub uses
......
...@@ -195,12 +195,13 @@ ...@@ -195,12 +195,13 @@
~@body))) ~@body)))
(defn- ^GetQueryResultsResponse get-query-results (defn- ^GetQueryResultsResponse get-query-results
[^Bigquery client ^String project-id ^String job-id ^String page-token] [^Bigquery client ^String project-id ^String job-id ^String location ^String page-token]
(when page-callback (when page-callback
(page-callback)) (page-callback))
(let [request (doto (.getQueryResults (.jobs client) project-id job-id) (let [request (doto (.getQueryResults (.jobs client) project-id job-id)
(.setMaxResults max-results-per-page) (.setMaxResults max-results-per-page)
(.setPageToken page-token))] (.setPageToken page-token)
(.setLocation location))]
(google/execute request))) (google/execute request)))
(defn- ^GetQueryResultsResponse execute-bigquery (defn- ^GetQueryResultsResponse execute-bigquery
...@@ -217,10 +218,11 @@ ...@@ -217,10 +218,11 @@
(bigquery.params/set-parameters! parameters)) (bigquery.params/set-parameters! parameters))
query-response ^QueryResponse (google/execute (.query (.jobs client) project-id request)) query-response ^QueryResponse (google/execute (.query (.jobs client) project-id request))
job-ref (.getJobReference query-response) job-ref (.getJobReference query-response)
location (.getLocation job-ref)
job-id (.getJobId job-ref) job-id (.getJobId job-ref)
proj-id (.getProjectId job-ref)] proj-id (.getProjectId job-ref)]
(with-finished-response [_ query-response] (with-finished-response [_ query-response]
(get-query-results client proj-id job-id nil))))) (get-query-results client proj-id job-id location nil)))))
(defn- post-process-native (defn- post-process-native
"Parse results of a BigQuery query. `respond` is the same function passed to "Parse results of a BigQuery query. `respond` is the same function passed to
...@@ -254,6 +256,7 @@ ...@@ -254,6 +256,7 @@
(with-finished-response [next-resp (get-query-results (database->client database) (with-finished-response [next-resp (get-query-results (database->client database)
(.getProjectId (.getJobReference response)) (.getProjectId (.getJobReference response))
(.getJobId (.getJobReference response)) (.getJobId (.getJobReference response))
(.getLocation (.getJobReference response))
next-page-token)] next-page-token)]
(fetch-page next-resp)))))] (fetch-page next-resp)))))]
(for [^TableRow row (fetch-page response)] (for [^TableRow row (fetch-page response)]
......
...@@ -152,7 +152,8 @@ ...@@ -152,7 +152,8 @@
job-ref (.getJobReference query-response) job-ref (.getJobReference query-response)
job-id (.getJobId job-ref) job-id (.getJobId job-ref)
proj-id (.getProjectId job-ref) proj-id (.getProjectId job-ref)
response (#'bigquery/get-query-results client proj-id job-id nil)] location (.getLocation job-ref)
response (#'bigquery/get-query-results client proj-id job-id location nil)]
(#'bigquery/post-process-native @details respond response))) (#'bigquery/post-process-native @details respond response)))
(defprotocol ^:private Insertable (defprotocol ^:private Insertable
......
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