On Tue, Apr 23, 2013 at 10:41 AM, Ferenc Vehmann
<
ferenc....@bitongo.com> wrote:
> Using body= results in an error:
>
> service.query().sql(body = sql_query)
>
> File "..../apiclient/discovery.py", line 573, in method
>
> raise TypeError('Got an unexpected keyword argument "%s"' % name)
>
> TypeError: Got an unexpected keyword argument "body"
Sorry, I wasn't suggesting you use body, just explaining that the function
signature would be different if the SQL was sent in the body of the
request.
>
> Batching is not really an options, at least not a straight forward one as
> the data is one line.
Use batching, take the singe request you are making, put it in a batch
request like the code I linked to, and then execute that batch. The request
should work as it did before, but it will not hit the URL limit from App Engine.
>
> However, I've managed to modify http.py so that it does put the date into
> the body.
> http.py:663
>
> if len(self.uri) > MAX_URI_LENGTH: # and self.method == 'GET':
>
> self.method = 'POST'
>
> # self.headers['x-http-method-override'] = 'GET'
>
> However, this is clearly not nice.
>
> I still don't understand why the query parameters end up in GET as there is
> POST in the discovery.
> ..
>
> "query": {
> "methods": {
> "sql": {
> "id": "fusiontables.query.sql",
> "path": "query",
> "httpMethod": "POST",
Because the sql parameter "location" is "query" which means to put it
in the query parameters:
"parameters": {
"hdrs": {
"type": "boolean",
"description": "Should column names be included (in the first
row)?. Default is true.",
"location": "query"
},
"sql": {
"type": "string",
"description": "An SQL
SELECT/SHOW/DESCRIBE/INSERT/UPDATE/DELETE/CREATE statement.",
"required": true,
"location": "query"