Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase, mail # user - Update table schema via REST

Copy link to this message
Re: Update table schema via REST
Andrew Purtell 2012-08-08, 18:35
Addressing for table creation or schema update (PUT or POST), schema
query (GET), or delete (DELETE)

    path := '/' <table> / 'schema'

So that should be  /TransactionREST/schema

However, I'd recommend that you not take administrative actions via
the REST API. Use the HBase shell instead. Consider them DBA-type

    - Andy

On Wed, Aug 8, 2012 at 11:15 AM, Corbett Martin <[EMAIL PROTECTED]> wrote:
> According to the Stargate documentation (http://wiki.apache.org/hadoop/Hbase/Stargate) I should be able to perform a POST operation to perform a table schema update.  The docs say to supply a "well formed schema fragment" for a table schema update.  My issue is the test code below always returns:
> <body><h2>HTTP ERROR 405</h2>
> <p>Problem accessing /TransactionREST/. Reason:
> <pre>Method Not Allowed</pre>
> What am I missing?  I cannot find any errors in the log files.
> It's worth mentioning that I've been able to successfully create a table via the REST api but now I want to use the api to make a table schema change, like in this example I want to add a new column-family to a table.
> class AlterTableExampleREST {
>       private static final String ALTER_TABLE >             "{\"name\":\"TransactionREST\",\"ColumnSchema\":[{\"name\":\"foo\"}]}";
>       public void modifyTable() throws IOException {
>             // Setup a Cluster list adding all known REST server hosts
>             Cluster cluster = new Cluster();
>             cluster.add("", 8080);
>             // Create Client to handle HTTP communication
>             Client client = new Client(cluster);
>             Response response = client.post("/TransactionREST/", "application/json",
>                   Bytes.toBytes(ALTER_TABLE));
>             if(response != null) {
>                   System.out.println("response code: " + response.getCode());
>                   if(response.hasBody()) {
>                         System.out.println("reponse body: " + Bytes.toString(response.getBody()));
>                   }
>             }
>       }
> }
> Thanks in advance!
> ________________________________
> This message and its contents (to include attachments) are the property of National Health Systems, Inc. and may contain confidential and proprietary information. This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. You are hereby notified that any unauthorized disclosure, copying, or distribution of this message, or the taking of any unauthorized action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately and notify the sender immediately by telephone or by replying to this transmission.