phoenix-user mailing list archives

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

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

Then I ran into a pythondb error very much like the one described at
https://bitbucket.org/lalinsky/python-phoenixdb/issues/1/error-on-avatica-150
.  So, I looked at the committed bug fix
<https://bitbucket.org/lalinsky/python-phoenixdb/commits/65ed3c64d830> and
guess that I needed to wrap everything up in a openConnection
/ closeConnection pair.

Also, the verbose log from shell.py --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
*that*.)

Thanks again, Lukas.  You can email me directly if you want me to help
troubleshoot pythondb for
https://dist.apache.org/repos/dist/dev/phoenix/phoenix-4.7.0-HBase-0.98-rc1/
.

Bye,
    Steve

On Fri, Feb 5, 2016 at 3:07 PM, Steve Terrell <sterrell@oculus360.us> 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ý <lalinsky@gmail.com> wrote:
>
>> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <sterrell@oculus360.us>
>> 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/avatica.py",
>>> 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/queryserver.py 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/shell.py --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
>>
>>
>

Mime
View raw message