In the BigQuery API documentation there is a method called patch. I am hoping that I can use it to alter the schema of an existing table. Unfortunately it is not supported by bq. But according to their website, you can try it at https://developers.google.com/bigquery/docs/reference/v2/tables/patch. However when I try it sends the following request:
PATCH https://www.googleapis.com/bigquery/v2/projects/(my project id)/datasets/tmp_bt/tables/change_cols?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer (removed)
X-JavaScript-User-Agent: Google APIs Explorer
{
"schema": {
"fields": [
{
},
{
},
{
"mode": "nullable",
"name": "gotchahere",
"type": "string"
}
]
}
}
(I have no idea where the empty elements came from, and the editor is too painful to use to just paste in my existing table definition. I note that it is missing required elements like my project ID, which I expected to be included because they were required in the form) and then I get the response:
cache-control: private, max-age=0
content-encoding: gzip
content-length: 122
content-type: application/json; charset=UTF-8
date: Thu, 13 Jun 2013 22:22:09 GMT
expires: Thu, 13 Jun 2013 22:22:09 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 503,
"message": "Backend Error"
}
}
which is utterly useless. I've done a web search, and failed to find any examples of it in use.
Can anyone give me an example of using BigQuery patch to alter a table, and a description of what it can actually do?