the jobs list API says I can filter jobs by state: done pending or running but in some cases I want to know all pending and running jobs, instead of run jobs list twice, I found the bq server accepts if I provide the stateFilter twice in qs, that's by httpie; it needs stateFilter=pending&stateFilter=running&... in the GET request parameters;
however with current google-cloud-node code, if I provide stateFilter: [ 'pending', 'running' ] in the getJobs call, the actual sent on the wire is stateFilter[0]=pending&stateFilter[1]=running&... which bq server just ignored
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/list
when I research where did that [0] [1] comes from, it turns to be a default behavior in request options, users need to turn on useQuerystring: true to avoid that,
https://www.npmjs.com/package/request#requestoptions-callback
So here comes a diff I made it working locally, I think request interceptors may also be able to get it working; but you guys may want to integrate this useQuerystring: true to be the default
--- ./node_modules/@google-cloud/bigquery/src/index.js.orig 2017-03-23 11:48:53.730426569 -0700
+++ ./node_modules/@google-cloud/bigquery/src/index.js 2017-04-03 03:13:23.873907848 -0700
@@ -613,15 +613,16 @@ BigQuery.prototype.getJobs = function(op
options = {};
}
options = options || {};
this.request({
uri: '/jobs',
- qs: options
+ qs: options,
+ useQuerystring: true,
}, function(err, resp) {
if (err) {
callback(err, null, null, resp);
return;
}
var nextQuery = null;
the jobs list API says I can filter jobs by state:
donependingorrunningbut in some cases I want to know all pending and running jobs, instead of run jobs list twice, I found the bq server accepts if I provide the stateFilter twice in qs, that's by httpie; it needsstateFilter=pending&stateFilter=running&...in the GET request parameters;however with current
google-cloud-nodecode, if I providestateFilter: [ 'pending', 'running' ]in thegetJobscall, the actual sent on the wire isstateFilter[0]=pending&stateFilter[1]=running&...which bq server just ignoredhttps://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/list
when I research where did that
[0][1]comes from, it turns to be a default behavior in request options, users need to turn onuseQuerystring: trueto avoid that,https://www.npmjs.com/package/request#requestoptions-callback
So here comes a diff I made it working locally, I think request interceptors may also be able to get it working; but you guys may want to integrate this
useQuerystring: trueto be the default