You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by jeevi tesh <je...@gmail.com> on 2014/03/03 16:27:50 UTC

Stargate Create table issue

Hi all,
Need to create table through rest endpoint so using stargate.
I'm able to create table getting status code of 201.
But unfortunately I'm not able to create table with value
In hbase shell  if issue command "scan ".I get 0 rows.
I guess it is issue with json. Can you please help what has went wrong in
json. And links to more documentation on how to work with json will be of
great help.
WebResource webResource = client.resource("
http://192.168.1.42:8080/table4/schema");
String input = "{\"Table\":[{\"name\":\"content\"},{\"name\":\"urls\"}]}";
ClientResponse response =
webResource.type("application/json").post(ClientResponse.class, input);
assertEquals(response.getStatus(),201);

Re: Stargate Create table issue

Posted by Bharath Vissapragada <bh...@cloudera.com>.
Hi Jeevi,

Your json format is incorrect. Suppose you are creating a table foobar with
colfam f1, your json should be as follows.

{"name":"foobar","IS_META":"false","IS_ROOT":"false","ColumnSchema":[{"name":"f1","BLOCKSIZE":"65536","BLOOMFILTER":"NONE","MIN_VERSIONS":"0","KEEP_DELETED_CELLS":"false","ENCODE_ON_DISK":"true","BLOCKCACHE":"true","COMPRESSION":"NONE","VERSIONS":"3","REPLICATION_SCOPE":"0","TTL":"2147483647","DATA_BLOCK_ENCODING":"NONE","IN_MEMORY":"false"}]}

Now suppose you want to add one more column family f2 to the existing
table, you can use a POST request with /foobar/schema endpoint with
following json payload,

{"ColumnSchema":[{"name":"f2","BLOCKSIZE":"65536","BLOOMFILTER":"NONE","MIN_VERSIONS":"0","KEEP_DELETED_CELLS":"false","ENCODE_ON_DISK":"true","BLOCKCACHE":"true","COMPRESSION":"NONE","VERSIONS":"3","REPLICATION_SCOPE":"0","TTL":"2147483647","DATA_BLOCK_ENCODING":"NONE","IN_MEMORY":"false"}]}

- Bharath


On Mon, Mar 3, 2014 at 8:57 PM, jeevi tesh <je...@gmail.com> wrote:

> Hi all,
> Need to create table through rest endpoint so using stargate.
> I'm able to create table getting status code of 201.
> But unfortunately I'm not able to create table with value
> In hbase shell  if issue command "scan ".I get 0 rows.
> I guess it is issue with json. Can you please help what has went wrong in
> json. And links to more documentation on how to work with json will be of
> great help.
> WebResource webResource = client.resource("
> http://192.168.1.42:8080/table4/schema");
> String input = "{\"Table\":[{\"name\":\"content\"},{\"name\":\"urls\"}]}";
> ClientResponse response =
> webResource.type("application/json").post(ClientResponse.class, input);
> assertEquals(response.getStatus(),201);
>



-- 
Bharath Vissapragada
<http://www.cloudera.com>