phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Terrell <>
Subject Re: Phoenix Query Server Avatica Upsert
Date Fri, 05 Feb 2016 23:53:57 GMT

I had to fix another trivial bug in to allow the
*-Dphoenix.queryserver.**serialization=JSON* to get passed to the Java

Then I ran into a pythondb error very much like the one described at
.  So, I looked at the committed bug fix
<> and
guess that I needed to wrap everything up in a openConnection
/ closeConnection pair.

Also, the verbose log from --debug , when compared to the above
verbose log, looked like the JSON was still being sent in the header
instead of the body.  I'm guessing the format is

DEBUG:phoenixdb.avatica:POST / *<body> <header>*

These two incidents leads me to guess that root cause of my issue with
pythondb is that it was not correctly recognizing the Avatica version.

Anyway, I got upserts working remotely with curl, with the request JSON in
the body.  I hope that having the request in the body will now allow me to
make these calls in Javascript.  (See my other email topic for details on

Thanks again, Lukas.  You can email me directly if you want me to help
troubleshoot pythondb for


On Fri, Feb 5, 2016 at 3:07 PM, Steve Terrell <> wrote:

> Thanks, Lukas.  Half the battle is won, now.  With your help I was able to
> see the JSON used to perform the upsert.  Looks like my problem was that I
> was not doing any "connectionSync" calls.  I had played around with the
> "createStatement" before my upsert SQL, but I may not have stumbled across
> the proper sequence.
> It would have been nice if somewhere there were Avatica docs to let people
> know what the sequence of calls must be.  For example:  first you do
> connectionSync, second you do createStatement, then you
> do prepareAndExecute, etc.
> I'll try your tip for starting the 4.7 server in JSON mode sometime soon.
> On Fri, Feb 5, 2016 at 1:59 PM, Lukáš Lalinský <> wrote:
>> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <>
>> wrote:
>>> When I tried to send a "createStatement" via curl and via Lukas's
>>> phoenixdb, I got these error's respectively:
>>> <h2>HTTP ERROR: 500</h2>
>>> <p>Problem accessing /. Reason:
>>> <pre>    Cannot find parser for </pre></p>
>>>   File "/usr/local/lib/python2.7/site-packages/phoenixdb/",
>>> line 100, in parse_error_page
>>>     raise errors.InternalError(message)
>>> phoenixdb.errors.InternalError: ('Cannot find parser for', None, None,
>>> None)
>>> Too bad - I think I need 4.7 to pass JSON in the HTTP request body.
>> 4.7 uses Protobuf3 serialization by default, but you can still make it
>> use JSON:
>> ./bin/ start -Dphoenix.queryserver.serialization=JSON
>>> However, I *was* able to get phoenixdb working with my Phoenix 4.6,
>>> both selects and upserts, both locally and remotely.  So, I'd like to take
>>> Lukas's advice and log what is being sent so I can replicate it outside of
>>> Python.
>>> Does anyone know:
>>>    - How to log the headers and body of all requests
>>> You should be able to run this and see the request/response details.
>> ./examples/ --debug http://localhost:8765/
>>>    - Where the Avatica documentation is for how to make queries for
>>>    different versions?  As I linked in my original email, all I could find was
>>>    syntax of the latest JSON, bit no docs on headers, post body, how to form
>>>    the HTTP request, etc.
>>> There is no documentation for the older versions of the protocol, as far
>> as I know. I based my library on the Java code in calcite.
>> Lukas

View raw message