I'm trying to create new table using BigQuery's Python API:
bigquery.tables().insert(
projectId="xxxxxxxxxxxxxx",
datasetId="xxxxxxxxxxxxxx",
body='{
"tableReference": {
"projectId":"xxxxxxxxxxxxxx",
"tableId":"xxxxxxxxxxxxxx",
"datasetId":"accesslog"},
"schema": {
"fields": [
{"type":"STRING", "name":"ip"},
{"type":"TIMESTAMP", "name":"ts"},
{"type":"STRING", "name":"event"},
{"type":"STRING", "name":"id"},
{"type":"STRING","name":"sh"},
{"type":"STRING", "name":"pub"},
{"type":"STRING", "name":"context"},
{"type":"STRING", "name":"brand"},
{"type":"STRING", "name":"product"}
]
}
}'
).execute()
The error I'm getting is:
(<class 'apiclient.errors.HttpError'>, <HttpError 400 when requesting https://www.googleapis.com/bigquery/v2/projects/xxxxxxxxxxxxxx/datasets/xxxxxxxxxxxxxx/tables?alt=json returned "Required parameter is missing">, <traceback object at 0x17e1c20>)
I think all required parameters are included as far as this is documented at https://developers.google.com/resources/api-libraries/documentation/bigquery/v2/python/latest/bigquery_v2.tables.html#insert
What's missing?