Google BigQuery insert using POST -


i'm trying insert data bigquery table using post request. application create body request in specified format:

--xxx content-type: application/json; charset=utf-8  {    "configuration": {        "load": {            "sourceformat": "newline_delimited_json"        },        "destinationtable": {            "projectid": "some-id",            "datasetid": "dataset-id",            "tableid": "cards"        }    } } --xxx content-type: application/octet-stream  {"board_id":1,"version":2,"card_id":1,"title":"tytul kartki 1"} --xxx-- 

but when send data using:

credentials = signedjwtassertioncredentials(         service_account_email,         key,         scope='https://www.googleapis.com/auth/bigquery') self.http = credentials.authorize(httplib2.http()) headers = {'content-type': 'multipart/related; boundary=xxx'} resp, content = self.http.request(url, method="post",                                        body=output,                                        headers=headers) 

the response server is:

status: {'date': 'thu, 25 jul 2013 12:49:06 gmt', 'status': '400', 'content-length': '205', 'content-type': 'application/json', 'server': 'http upload server built on jul 12 2013 17:12:36 (1373674356)'} content: {  "error": {   "errors": [    {     "domain": "global",     "reason": "required",     "message": "required parameter missing"    }   ],   "code": 400,   "message": "required parameter missing"  } } 

i have no idea parameter missing. parameter required in documentation sourceuris want load data request body not gs.

i think problem missing schema configuration:

'configuration': {   'load': {     'sourceformat': <required json files>',     'schema': {       'fields': [         {'name':'f1', 'type':'string'},         {'name':'f2', type:'integer'}       ]     },     'destinationtable': {       'projectid': 'projectid',       'datasetid': 'datasetid',       'tableid': 'tableid'     }   } } 

this link maybe you: https://developers.google.com/bigquery/loading-data-into-bigquery


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -