You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@phoenix.apache.org by Steve Terrell <st...@oculus360.us> on 2016/02/05 17:16:24 UTC

Phoenix Query Server Avatica Upsert

Does anyone have an example of how to upsert a row in a Phoenix table via
the Avatica HTTP mechanism?

The closest thing to documentation I can find are these two links:

   -
   https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
   - https://calcite.apache.org/docs/avatica_json_reference.html

I got the select example working, but cannot get an upsert to work.

Thanks,
    Steve

Re: Phoenix Query Server Avatica Upsert

Posted by Steve Terrell <st...@oculus360.us>.
Done!  PHOENIX-2659 - Minor Bugs in queryserver.py
<https://issues.apache.org/jira/browse/PHOENIX-2659>

On Sat, Feb 6, 2016 at 12:28 AM, James Taylor <ja...@apache.org>
wrote:

> Glad you got it working, Steve. If you have a chance to file JIRAs where
> you ran into issues, that'd be much appreciated.
>
> Lukás - your Python Query Server support would be a welcome addition to
> Phoenix or Avatica. Send us a pull request for a new module if you're
> interested.
>
>     James
>
> On Friday, February 5, 2016, Steve Terrell <st...@oculus360.us> wrote:
>
>> 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 <st...@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ý <la...@gmail.com>
>>> wrote:
>>>
>>>> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <st...@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
>>>>
>>>>
>>>
>>

Re: Phoenix Query Server Avatica Upsert

Posted by Josh Elser <jo...@gmail.com>.
Yeah, I don't think the inclusion of Python code should be viewed as a 
barrier to inclusion (maybe just a hurdle). I've seen other projects 
(Ambari, iirc) which have tons of Python code and lots of integration.

The serialization for PQS can be changed via a single configuration 
property in hbase-site.xml. If this is insufficient, we can explore CLI 
options to queryserver.py to make this even easier. Protobuf is going to 
inherently be a more stable wire format, but that doesn't mean you can't 
use JSON if you have a reason (that's why it wasn't removed).

James Taylor wrote:
> Sorry for the delayed response, Lukáš. I still think it would be a good
> addition and the JSON/Protobuf issue you brought up is all the more
> reason to keep the JSON binding too.
>
> We have precedence for non Java code with our Spark integration. Sure,
> it makes it a bit more work to add this new module, but it's definitely
> doable. And worst-case, the uploading to PyPI could be a manual, post
> release task.
>
> TLDR; if you're willing to package this as a new module (including
> regression tests), we'd be excited to have it.
>
> Any opinions, Josh?
>
> Thanks,
> James
>
> On Fri, Feb 5, 2016 at 11:37 PM, Lukáš Lalinský <lalinsky@gmail.com
> <ma...@gmail.com>> wrote:
>
>     On Sat, Feb 6, 2016 at 7:28 AM, James Taylor <jamestaylor@apache.org
>     <ma...@apache.org>> wrote:
>
>         Lukás- your Python Query Server support would be a welcome
>         addition to Phoenix or Avatica. Send us a pull request for a new
>         module if you're interested.
>
>
>     I was considering that when I got the first working version, but I
>     was not sure how to best do it. Phoenix would probably be the better
>     place for it, since it's really specific to Phoenix (data types, etc.).
>
>     There is also the practical issue of having non-Java code in a
>     mainly Java project. For Python module to be easily installable, it
>     should be uploaded to PyPI (equivalent to Maven Central in the Java
>     world) and that would have to be a part of the release process. Or
>     it could just live in the repository, but have a separate release
>     schedule, which would be easier to manage.
>
>     Anyway, since the protobuf3 serialization is now the default in
>     Phoenix, I don't know if it makes sense anymore. That significantly
>     complicates packaging of the Python module, so I was planning to
>     stick with JSON.
>
>     Lukas
>
>
>

Re: Phoenix Query Server Avatica Upsert

Posted by James Taylor <ja...@apache.org>.
Sorry for the delayed response, Lukáš. I still think it would be a good
addition and the JSON/Protobuf issue you brought up is all the more reason
to keep the JSON binding too.

We have precedence for non Java code with our Spark integration. Sure, it
makes it a bit more work to add this new module, but it's definitely
doable. And worst-case, the uploading to PyPI could be a manual, post
release task.

TLDR; if you're willing to package this as a new module (including
regression tests), we'd be excited to have it.

Any opinions, Josh?

Thanks,
James

On Fri, Feb 5, 2016 at 11:37 PM, Lukáš Lalinský <la...@gmail.com> wrote:

> On Sat, Feb 6, 2016 at 7:28 AM, James Taylor <ja...@apache.org>
> wrote:
>
>> Lukás - your Python Query Server support would be a welcome addition to
>> Phoenix or Avatica. Send us a pull request for a new module if you're
>> interested.
>>
>
> I was considering that when I got the first working version, but I was not
> sure how to best do it. Phoenix would probably be the better place for it,
> since it's really specific to Phoenix (data types, etc.).
>
> There is also the practical issue of having non-Java code in a mainly Java
> project. For Python module to be easily installable, it should be uploaded
> to PyPI (equivalent to Maven Central in the Java world) and that would have
> to be a part of the release process. Or it could just live in the
> repository, but have a separate release schedule, which would be easier to
> manage.
>
> Anyway, since the protobuf3 serialization is now the default in Phoenix, I
> don't know if it makes sense anymore. That significantly complicates
> packaging of the Python module, so I was planning to stick with JSON.
>
> Lukas
>
>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Lukáš Lalinský <la...@gmail.com>.
On Sat, Feb 6, 2016 at 7:28 AM, James Taylor <ja...@apache.org> wrote:

> Lukás - your Python Query Server support would be a welcome addition to
> Phoenix or Avatica. Send us a pull request for a new module if you're
> interested.
>

I was considering that when I got the first working version, but I was not
sure how to best do it. Phoenix would probably be the better place for it,
since it's really specific to Phoenix (data types, etc.).

There is also the practical issue of having non-Java code in a mainly Java
project. For Python module to be easily installable, it should be uploaded
to PyPI (equivalent to Maven Central in the Java world) and that would have
to be a part of the release process. Or it could just live in the
repository, but have a separate release schedule, which would be easier to
manage.

Anyway, since the protobuf3 serialization is now the default in Phoenix, I
don't know if it makes sense anymore. That significantly complicates
packaging of the Python module, so I was planning to stick with JSON.

Lukas

Phoenix Query Server Avatica Upsert

Posted by James Taylor <ja...@apache.org>.
Glad you got it working, Steve. If you have a chance to file JIRAs where
you ran into issues, that'd be much appreciated.

Lukás - your Python Query Server support would be a welcome addition to
Phoenix or Avatica. Send us a pull request for a new module if you're
interested.

    James

On Friday, February 5, 2016, Steve Terrell <sterrell@oculus360.us
<javascript:_e(%7B%7D,'cvml','sterrell@oculus360.us');>> wrote:

> 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 <st...@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ý <la...@gmail.com>
>> wrote:
>>
>>> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <st...@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
>>>
>>>
>>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Lukáš Lalinský <la...@gmail.com>.
On Sat, Feb 6, 2016 at 12:53 AM, Steve Terrell <st...@oculus360.us>
wrote:

> 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.
>

Unfortunately, there is no good way to automatically recognize the Avatica
version just by using the server. I added a special parameter to the URL,
so that you can do things like 'http://localhost:8765/?v=1.5'.

Lukas

Re: Phoenix Query Server Avatica Upsert

Posted by Steve Terrell <st...@oculus360.us>.
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 <st...@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ý <la...@gmail.com> wrote:
>
>> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <st...@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
>>
>>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Steve Terrell <st...@oculus360.us>.
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ý <la...@gmail.com> wrote:

> On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <st...@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
>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Lukáš Lalinský <la...@gmail.com>.
On Fri, Feb 5, 2016 at 8:46 PM, Steve Terrell <st...@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

Re: Phoenix Query Server Avatica Upsert

Posted by Steve Terrell <st...@oculus360.us>.
I'm using HBase 0.98.15, so I installed
https://dist.apache.org/repos/dist/dev/phoenix/phoenix-4.7.0-HBase-0.98-rc1/

Had a problem starting the query server that I resolved by
deleting $PHOENIX_OPTS from queryserver.py .  (It was giving me "Error:
Could not find or load main class $PHOENIX_OPTS")

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.

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
   - 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.

Thanks again,
    Steve

On Fri, Feb 5, 2016 at 11:29 AM, James Taylor <ja...@apache.org>
wrote:

> But please feel free to play around with the last RC:
> http://mail-archives.apache.org/mod_mbox/phoenix-dev/201601.mbox/%3CCAAF1JdgFzrwWBBcs586hkJnoZaZFBYDGxtaqUZjAuQM1XwBgOQ%40mail.gmail.com%3E
>
> On Fri, Feb 5, 2016 at 9:26 AM, James Taylor <ja...@apache.org>
> wrote:
>
>> Phoenix 4.7.0 is not released yet. A couple of issues can up in the last
>> RC, so we'll roll a new one very soon.
>>
>> Thanks,
>> James
>>
>> On Fri, Feb 5, 2016 at 9:23 AM, Steve Terrell <st...@oculus360.us>
>> wrote:
>>
>>> Oh, I didn't know there was a 4.7.  Following the links on
>>> https://phoenix.apache.org/download.html only takes me to locations
>>> that have 4.6 available to download, which is the version I am using.
>>>
>>> Looking at my 4.6 pom.xml it appears to be build
>>> with <calcite.version>1.3.0-incubating</calcite.version> , which
>>> incidentally may answer my other related/similar question in my other
>>> email:  How to send the query on the body.  I now see form your source code
>>> that this is only supported for "if self.version >= AVATICA_1_4_0:"
>>>
>>> So I will hunt for Phoenix 4.7 to see if it can solved both my issues.
>>> Thank you, Lukas.
>>>
>>> By the way, in case this helps anyone else, I found these two links:
>>>
>>>    - http://hortonworks.com/search-results/?search=phoenix+query+server
>>>    -
>>>    https://community.hortonworks.com/questions/1985/phoenix-query-server-upsert-fail.html
>>>
>>> Thanks,
>>>     Steve
>>>
>>> On Fri, Feb 5, 2016 at 10:41 AM, Lukáš Lalinský <la...@gmail.com>
>>> wrote:
>>>
>>>> This depends on the exact version of Avatica you are using, because
>>>> it's different in all released versions.
>>>>
>>>> In this comment you can see an example of running UPSERT with 1.4 with
>>>> the JSON serializer (I think Phoenix 4.7 includes that version):
>>>>
>>>>
>>>> https://issues.apache.org/jira/browse/CALCITE-1050?focusedCommentId=15093324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15093324
>>>>
>>>> You can also try my Python module for talking to the server. With
>>>> verbose logging, it will print the exact JSON documents it's sending.
>>>>
>>>> https://code.oxygene.sk/lukas/python-phoenixdb
>>>>
>>>> Lukas
>>>>
>>>>
>>>> On Fri, Feb 5, 2016 at 5:16 PM, Steve Terrell <st...@oculus360.us>
>>>> wrote:
>>>>
>>>>> Does anyone have an example of how to upsert a row in a Phoenix table
>>>>> via the Avatica HTTP mechanism?
>>>>>
>>>>> The closest thing to documentation I can find are these two links:
>>>>>
>>>>>    -
>>>>>    https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
>>>>>    - https://calcite.apache.org/docs/avatica_json_reference.html
>>>>>
>>>>> I got the select example working, but cannot get an upsert to work.
>>>>>
>>>>> Thanks,
>>>>>     Steve
>>>>>
>>>>
>>>>
>>>
>>
>

Re: Phoenix Query Server Avatica Upsert

Posted by James Taylor <ja...@apache.org>.
But please feel free to play around with the last RC:
http://mail-archives.apache.org/mod_mbox/phoenix-dev/201601.mbox/%3CCAAF1JdgFzrwWBBcs586hkJnoZaZFBYDGxtaqUZjAuQM1XwBgOQ%40mail.gmail.com%3E

On Fri, Feb 5, 2016 at 9:26 AM, James Taylor <ja...@apache.org> wrote:

> Phoenix 4.7.0 is not released yet. A couple of issues can up in the last
> RC, so we'll roll a new one very soon.
>
> Thanks,
> James
>
> On Fri, Feb 5, 2016 at 9:23 AM, Steve Terrell <st...@oculus360.us>
> wrote:
>
>> Oh, I didn't know there was a 4.7.  Following the links on
>> https://phoenix.apache.org/download.html only takes me to locations that
>> have 4.6 available to download, which is the version I am using.
>>
>> Looking at my 4.6 pom.xml it appears to be build
>> with <calcite.version>1.3.0-incubating</calcite.version> , which
>> incidentally may answer my other related/similar question in my other
>> email:  How to send the query on the body.  I now see form your source code
>> that this is only supported for "if self.version >= AVATICA_1_4_0:"
>>
>> So I will hunt for Phoenix 4.7 to see if it can solved both my issues.
>> Thank you, Lukas.
>>
>> By the way, in case this helps anyone else, I found these two links:
>>
>>    - http://hortonworks.com/search-results/?search=phoenix+query+server
>>    -
>>    https://community.hortonworks.com/questions/1985/phoenix-query-server-upsert-fail.html
>>
>> Thanks,
>>     Steve
>>
>> On Fri, Feb 5, 2016 at 10:41 AM, Lukáš Lalinský <la...@gmail.com>
>> wrote:
>>
>>> This depends on the exact version of Avatica you are using, because it's
>>> different in all released versions.
>>>
>>> In this comment you can see an example of running UPSERT with 1.4 with
>>> the JSON serializer (I think Phoenix 4.7 includes that version):
>>>
>>>
>>> https://issues.apache.org/jira/browse/CALCITE-1050?focusedCommentId=15093324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15093324
>>>
>>> You can also try my Python module for talking to the server. With
>>> verbose logging, it will print the exact JSON documents it's sending.
>>>
>>> https://code.oxygene.sk/lukas/python-phoenixdb
>>>
>>> Lukas
>>>
>>>
>>> On Fri, Feb 5, 2016 at 5:16 PM, Steve Terrell <st...@oculus360.us>
>>> wrote:
>>>
>>>> Does anyone have an example of how to upsert a row in a Phoenix table
>>>> via the Avatica HTTP mechanism?
>>>>
>>>> The closest thing to documentation I can find are these two links:
>>>>
>>>>    -
>>>>    https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
>>>>    - https://calcite.apache.org/docs/avatica_json_reference.html
>>>>
>>>> I got the select example working, but cannot get an upsert to work.
>>>>
>>>> Thanks,
>>>>     Steve
>>>>
>>>
>>>
>>
>

Re: Phoenix Query Server Avatica Upsert

Posted by James Taylor <ja...@apache.org>.
Phoenix 4.7.0 is not released yet. A couple of issues can up in the last
RC, so we'll roll a new one very soon.

Thanks,
James

On Fri, Feb 5, 2016 at 9:23 AM, Steve Terrell <st...@oculus360.us> wrote:

> Oh, I didn't know there was a 4.7.  Following the links on
> https://phoenix.apache.org/download.html only takes me to locations that
> have 4.6 available to download, which is the version I am using.
>
> Looking at my 4.6 pom.xml it appears to be build
> with <calcite.version>1.3.0-incubating</calcite.version> , which
> incidentally may answer my other related/similar question in my other
> email:  How to send the query on the body.  I now see form your source code
> that this is only supported for "if self.version >= AVATICA_1_4_0:"
>
> So I will hunt for Phoenix 4.7 to see if it can solved both my issues.
> Thank you, Lukas.
>
> By the way, in case this helps anyone else, I found these two links:
>
>    - http://hortonworks.com/search-results/?search=phoenix+query+server
>    -
>    https://community.hortonworks.com/questions/1985/phoenix-query-server-upsert-fail.html
>
> Thanks,
>     Steve
>
> On Fri, Feb 5, 2016 at 10:41 AM, Lukáš Lalinský <la...@gmail.com>
> wrote:
>
>> This depends on the exact version of Avatica you are using, because it's
>> different in all released versions.
>>
>> In this comment you can see an example of running UPSERT with 1.4 with
>> the JSON serializer (I think Phoenix 4.7 includes that version):
>>
>>
>> https://issues.apache.org/jira/browse/CALCITE-1050?focusedCommentId=15093324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15093324
>>
>> You can also try my Python module for talking to the server. With verbose
>> logging, it will print the exact JSON documents it's sending.
>>
>> https://code.oxygene.sk/lukas/python-phoenixdb
>>
>> Lukas
>>
>>
>> On Fri, Feb 5, 2016 at 5:16 PM, Steve Terrell <st...@oculus360.us>
>> wrote:
>>
>>> Does anyone have an example of how to upsert a row in a Phoenix table
>>> via the Avatica HTTP mechanism?
>>>
>>> The closest thing to documentation I can find are these two links:
>>>
>>>    -
>>>    https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
>>>    - https://calcite.apache.org/docs/avatica_json_reference.html
>>>
>>> I got the select example working, but cannot get an upsert to work.
>>>
>>> Thanks,
>>>     Steve
>>>
>>
>>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Steve Terrell <st...@oculus360.us>.
Oh, I didn't know there was a 4.7.  Following the links on
https://phoenix.apache.org/download.html only takes me to locations that
have 4.6 available to download, which is the version I am using.

Looking at my 4.6 pom.xml it appears to be build
with <calcite.version>1.3.0-incubating</calcite.version> , which
incidentally may answer my other related/similar question in my other
email:  How to send the query on the body.  I now see form your source code
that this is only supported for "if self.version >= AVATICA_1_4_0:"

So I will hunt for Phoenix 4.7 to see if it can solved both my issues.
Thank you, Lukas.

By the way, in case this helps anyone else, I found these two links:

   - http://hortonworks.com/search-results/?search=phoenix+query+server
   -
   https://community.hortonworks.com/questions/1985/phoenix-query-server-upsert-fail.html

Thanks,
    Steve

On Fri, Feb 5, 2016 at 10:41 AM, Lukáš Lalinský <la...@gmail.com> wrote:

> This depends on the exact version of Avatica you are using, because it's
> different in all released versions.
>
> In this comment you can see an example of running UPSERT with 1.4 with the
> JSON serializer (I think Phoenix 4.7 includes that version):
>
>
> https://issues.apache.org/jira/browse/CALCITE-1050?focusedCommentId=15093324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15093324
>
> You can also try my Python module for talking to the server. With verbose
> logging, it will print the exact JSON documents it's sending.
>
> https://code.oxygene.sk/lukas/python-phoenixdb
>
> Lukas
>
>
> On Fri, Feb 5, 2016 at 5:16 PM, Steve Terrell <st...@oculus360.us>
> wrote:
>
>> Does anyone have an example of how to upsert a row in a Phoenix table via
>> the Avatica HTTP mechanism?
>>
>> The closest thing to documentation I can find are these two links:
>>
>>    -
>>    https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
>>    - https://calcite.apache.org/docs/avatica_json_reference.html
>>
>> I got the select example working, but cannot get an upsert to work.
>>
>> Thanks,
>>     Steve
>>
>
>

Re: Phoenix Query Server Avatica Upsert

Posted by Lukáš Lalinský <la...@gmail.com>.
This depends on the exact version of Avatica you are using, because it's
different in all released versions.

In this comment you can see an example of running UPSERT with 1.4 with the
JSON serializer (I think Phoenix 4.7 includes that version):

https://issues.apache.org/jira/browse/CALCITE-1050?focusedCommentId=15093324&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15093324

You can also try my Python module for talking to the server. With verbose
logging, it will print the exact JSON documents it's sending.

https://code.oxygene.sk/lukas/python-phoenixdb

Lukas


On Fri, Feb 5, 2016 at 5:16 PM, Steve Terrell <st...@oculus360.us> wrote:

> Does anyone have an example of how to upsert a row in a Phoenix table via
> the Avatica HTTP mechanism?
>
> The closest thing to documentation I can find are these two links:
>
>    -
>    https://community.hortonworks.com/questions/1565/phoenix-query-server-documentation.html
>    - https://calcite.apache.org/docs/avatica_json_reference.html
>
> I got the select example working, but cannot get an upsert to work.
>
> Thanks,
>     Steve
>