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

Josh Elser commented on CALCITE-1081:
-------------------------------------

{quote}
If we start on the assumption that the JSON and Protobuf reference 
documentation is up to date, we should be able to write some general 
information about how to use those Requests with Avatica (regardless of how the 
requests are being sent – e.g. curl, python, etc).

I have the updates staged: 
[http://people.apache.org/~elserj/calcite/docs/avatica_example_client.html]
{quote}

Hrmph. It seems my laptop failure a few months back included this content. 
Shame that Steve decided to go his own direction, but I think some of what I 
wrote before still has value. I should re-translate back to markdown and get 
this into the site.

> Need Detailed Documentation for HTTP Avatica Support
> ----------------------------------------------------
>
>                 Key: CALCITE-1081
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1081
>             Project: Calcite
>          Issue Type: Improvement
>          Components: avatica
>            Reporter: Steve T
>            Assignee: Josh Elser
>            Priority: Major
>
> I was unable to find any documentation on how to use the Avatica features.  I 
> was not even able to find them on the Avatica site.  Would be great if 
> Phoenix had a least a few examples of how to us the feature such as the one I 
> wrote below.  It took me 2-3 days to figure it out with the help of 
> u...@phoenix.apache.org .  Should have only taken about 15 minutes.  Granted, 
> the JSON format is outdated in recent versions, but you get the idea.  I 
> couldn't even figure out which requests were required and what sequence they 
> had to be in.
> {code:title=example_upsert.sh|borderStyle=solid}
> #!/bin/bash
> curl -XPOST -H 'Content-Type application/json; charset=UTF-8' -d 
> '{"connectionId": "00000000-0000-0000-0000-000000000000", "request": 
> "openConnection"}' http://10.0.100.28:8765/
> curl -XPOST -d '{"connectionId": "00000000-0000-0000-0000-000000000000", 
> "request": "connectionSync", "connProps": {"autoCommit": null, "connProps": 
> "connPropsImpl", "transactionIsolation": null, "catalog": null, "readOnly": 
> null, "dirty": null, "schema": null}}' http://10.0.100.28:8765/
> curl -XPOST -d '{"connectionId": "00000000-0000-0000-0000-000000000000", 
> "request": "connectionSync", "connProps": {"autoCommit": true, "connProps": 
> "connPropsImpl", "transactionIsolation": null, "catalog": null, "readOnly": 
> null, "dirty": null, "schema": null}}' http://10.0.100.28:8765/
> curl -XPOST -d 
> "{\"request\":\"createStatement\",\"connectionId\":\"00000000-0000-0000-0000-000000000000\"}"
>  http://10.0.100.28:8765/
> echo
> echo Enter the statementId:
> read statement_id
> echo
> echo Enter the value:
> read value
> curl -XPOST -d 
> "{\"request\":\"prepareAndExecute\",\"connectionId\":\"00000000-0000-0000-0000-000000000000\",\"sql\":\"upsert
>  into CAT_MAP(CHA, CAT, MAP) values('TEST_RECORD_CHANNEL', 
> 'Test::Record::Channel::Category', '$value')\", 
> \"statementId\":$statement_id}" http://10.0.100.28:8765/
> curl -XPOST -d 
> "{\"request\":\"prepareAndExecute\",\"connectionId\":\"00000000-0000-0000-0000-000000000000\",\"sql\":\"upsert
>  into CAT_MAP(CHA, CAT, MAP) values('TEST_RECORD_CHANNEL2', 
> 'Test::Record::Channel::Category', '$value')\", 
> \"statementId\":$statement_id}" http://10.0.100.28:8765/
> curl -XPOST -d 
> "{\"request\":\"closeStatement\",\"connectionId\":\"00000000-0000-0000-0000-000000000000\",
>  \"statementId\":$statement_id}" http://10.0.100.28:8765/
> curl -XPOST -d '{"connectionId": "00000000-0000-0000-0000-000000000000", 
> "request": "closeConnection"}' http://10.0.100.28:8765/
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to