Database Reference
In-Depth Information
Using bq --apilog to Understand the
BigQuery API
Sometimes you try running something against the BigQuery API that
you're pretty sure should work, but for some reason you get back a
cryptic error. One way of figuring out what is wrong is to compare it
against a tool that you know works.
The bq command-line client has an -- apilog flag that can be used to
see exactly what requests and responses are sent. It does skip a couple
of details, such as the authorization header (as a security precaution),
but, in general it is useful to understand what is happening at the raw
HTTP level.
For example, the way to list projects in bq is to run bq ls -p . If you
just add the -- apilog= - parameter (the “-” tells it to output to
stdout ), and you can see the HTTP request that was sent:
$ bq --apilog=- ls -p
INFO:apiclient.discovery:URL being requested:
https://www.googleapis.com/bigquery/v2/
projects?alt=json
INFO:root:--response-start--
INFO:root:status: 200
INFO:root:{
"projects": [
{
"kind": "bigquery#project",
"id": "540617388650",
"numericId": "540617388650",
"projectReference": {
"projectId": "540617388650"
},
Search WWH ::




Custom Search