Python load failed with parse error

145 views
Skip to first unread message

Hans Rietveld

unread,
Jan 13, 2012, 5:22:59 AM1/13/12
to BigQuery discuss
New with BigQuery and new with Python.

Using the example in http://code.google.com/intl/nl-NL/apis/bigquery/docs/developers_guide.html#csvformat

and adjust form my own purpose.
Captured the newresource (see below)

Please explain what is wrong?

--xxx
Content-Type: application/json; charset=UTF-8

{
"configuration": {
"load": {
"schema": {
"fields": [
{"name":"Code", "type":"STRING"},
{"name":"Jaar", "type":"STRING"},
{"name":"Maand", "type":"STRING"},
{"name":"AantalGevondenAct", "type":"STRING"},
{"name":"AantalRequestGBZ", "type":"STRING"},
{"name":"BerichtgrootteRequest", "type":"STRING"},
{"name":"BerichtgrootteResponse", "type":"STRING"},
{"name":"DuurRoundtrip", "type":"STRING"},
{"name":"DuurZIM", "type":"STRING"},
{"name":"GBZTijd", "type":"INTEGER"},
{"name":"Interactie", "type":"STRING"},
{"name":"Locatie", "type":"STRING"},
]
},
"destinationTable": {
"projectId": "Test",
"datasetId": "Binnenkomen",
"tableId": "HansImportFirst"
}
"createDisposition": "CREATE_IF_NEEDED",
"writeDisposition": "WRITE_APPEND"
}
}
}
--xxx
Content-Type: application/octet-stream

OK,
2011,11,0,1,7837,854,12.601,0.093,12,REPC_IN990003NL,Waarneembericht
OK,2011,11,1,0,4473,845,0.166,0.166,0,MFMT_IN002101,AanmeldenGegevens
OK,
2011,11,0,0,2734,2241,0.097,0.097,0,QUPC_IN990001NL,WaarneemberichtBatch
OK,
2011,11,2,2,3112,155010,6.673,0.409,6,QURX_IN990011NL,VerstrekkingsqueryBatch

OK,
2011,11,0,0,2730,2241,8.113,8.113,0,QUPC_IN990001NL,WaarneemberichtBatch
OK,
2011,11,0,0,3108,2241,5.832,5.832,0,QURX_IN990011NL,VerstrekkingsqueryBatch
OK,
2011,11,0,0,2878,2241,1.155,1.155,0,QUPC_IN990001NL,WaarneemberichtBatch
OK,
2011,11,0,0,3256,2241,7.955,7.955,0,QURX_IN990011NL,VerstrekkingsqueryBatch
OK,
2011,11,0,0,2844,2241,0.444,0.444,0,QUPC_IN990001NL,WaarneemberichtBatch
OK,
2011,11,1,1,3222,138192,6.602,0.959,5,QURX_IN990011NL,VerstrekkingsqueryBatch


{'status': '400', 'content-length': '171', 'expires': 'Fri, 01 Jan
1990 00:00:00
GMT', 'server': 'HTTP Upload Server Built on Jan 9 2012 15:37:21
(1326152241)',
'pragma': 'no-cache', 'cache-control': 'no-cache, no-store, must-
revalidate', '
date': 'Fri, 13 Jan 2012 10:12:53 GMT', 'content-type': 'application/
json'}

{
"error": {
"errors": [
{
"domain": "global",
"reason": "parseError",
"message": "Parse Error"
}
],
"code": 400,
"message": "Parse Error"
}
}
--




CSC • This is a PRIVATE message. If you are not the intended recipient,
please delete without copying and kindly advise us by e-mail of the mistake
in delivery. NOTE: Regardless of content, this e-mail shall not operate to
bind CSC to any order or other contract unless pursuant to explicit written
agreement or government initiative expressly permitting the use of e-mail
for such purpose • CSC Computer Sciences BV • Registered Office:
Orteliuslaan 1004, 3528 BD Utrecht, The Netherlands • Registered in The
Netherlands No: 33239071

Rufus

unread,
Jan 15, 2012, 6:22:43 PM1/15/12
to BigQuery discuss
Hello,

Is the first field ("Code") on a line by itself? Each CSV row must
have only one line ending, at the end of the line.

I'm not sure this is the error -- I would have expected a more
specific error message complaining about missing fields, not a general
parse error. But if your first field ends with ",\n" this could be
contributing to the problem.

Also, why are you importing year and month as strings when they would
function better as integers? Similarly with the float values you have
in some columns.

Hans Rietveld

unread,
Jan 16, 2012, 2:56:47 AM1/16/12
to BigQuery discuss
Hello Rufus,

Thank you for you respons.

The Data (txt file) with the same specs imports using the webbrowser
tool. I made everything string because I don't want to have errors (at
this point) regarding decimal point or so (In the Netherlands as a
decimal point a comma is used).

There are two reasons to use Python for the import:
- The webbrowser tool limits the size of the import.
- I need it fur further try-outs of BigQuery, the need to append data
automatically to a table.

BTW the first field is not a line by itself.

Hans

Michael Sheldon

unread,
Jan 18, 2012, 4:11:07 PM1/18/12
to bigquery...@googlegroups.com
Hello Hans,

This error is returned when we cannot parse the body of the request.

Looking closely at the json request you sent, there appears to be a missing comma after the destinationTable definition.

If this is not the case, then please let us know and we'll send you a tracing token to include in the request. The tracing token should let us pinpoint the problem.

In either case, that error message needs to be improved. Thank you for bringing this to our attention!

--Michael Sheldon

Hans Rietveld

unread,
Jan 19, 2012, 8:30:50 AM1/19/12
to BigQuery discuss
Hello,
Thank you for your answer.

I found some context errors and all is working fine now. Especially
after switching network and not working after a proxy anymore.

Thanks for the help

On 18 jan, 22:11, Michael Sheldon <mshel...@google.com> wrote:
> Hello Hans,
>
> This error is returned when we cannot parse the body of the request.
>
> Looking closely at the json request you sent, there appears to be a missing
> comma after the destinationTable definition.
>
> If this is not the case, then please let us know and we'll send you a
> tracing token to include in the request. The tracing token should let us
> pinpoint the problem.
>
> In either case, that error message needs to be improved. Thank you for
> bringing this to our attention!
>
> --Michael Sheldon
>
Reply all
Reply to author
Forward
0 new messages