0

I just have some trouble with the example for creating a table using the BigQuery API: https://developers.google.com/bigquery/docs/developers_guide#creatingatable

Everything before worked just fine but here I always receive a parsing exception... Below the body sent in the request (I actually modified the example to the data and schema of the next example in the tutorial, but had the same issue with the original schema + self generated dataset) and the error response.

When I upload the same dataset using the webinterface and same schema it works like a charm.....

Thanks for any helpful clue!

Joerg


 --xxx Content-Type: application/json; charset=UTF-8 { "configuration": { "load": { "schema": { "fields": [ { "name": "Name", "type": "STRING", "mode": "REQUIRED", }, { "name": "Age", "type": "INTEGER", "mode": "REQUIRED", }, { "name": "Weight", "type": "FLOAT", "mode": "REQUIRED", }, { "name": "IsMagic", "type": "BOOLEAN", "mode": "REQUIRED", } ] }, "destinationTable": { "projectId": "536201353583", "datasetId": "Benchmark", "tableId": "syntest2" } "writeDisposition": "WRITE_APPEND" } } } --xxx Content-Type: application/octet-stream "Shooting Star",15,325.5,true "Magic Muffin",12,411.5,true "Blaze",16,312.2,false "Old Red",22,388.2,false --xxx-- 

 {'status': '400', 'content-length': '171', 'expires': 'Fri, 01 Jan 1990 00:00:00 GMT', 'server': 'HTTP Upload Server Built on Apr 30 2012 12:11:36 (1335813096)', 'pragma': 'no-cache', 'cache-control': 'no-cache, no-store, must-revalidate', 'date': 'Thu, 03 May 2012 19:40:00 GMT', 'content-type': 'application/json'} { "error": { "errors": [ { "domain": "global", "reason": "parseError", "message": "Parse Error" } ], "code": 400, "message": "Parse Error" } } 
1

2 Answers 2

2

The parse error you're seeing refers to your JSON request, not the CSV data.

In addition to the parse error noted by Jordan (missing comma after destinationTable), you also have trailing commas in the objects defining the table schema, which is invalid JSON. Try removing them and see if that helps!

Sign up to request clarification or add additional context in comments.

Comments

1

It looks like you're missing a comma between the end brace of destinationTable and the writeDisposition specifier.

1 Comment

Hi,thanks for pointing this out. Unfortunately didn't help to resolve my problem... Is the parse error concerning the request or the actual data?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.