HBase write request need table name

71 views Asked by At

Just wondering if HBase write request should contain at least table name and row key or just a row key (no need table name)?

I'm just going through practice exam and this question come up.

Google is not helping.

Thanks

1

There are 1 answers

0
Kishore On

should contain tablename, row and column-family

see example

hbase(main):002:0> create 'testtable', 'colfam1'
0 row(s) in 0.2930 seconds

to see table

hbase(main):003:0> list 'testtable'
TABLE
testtable
1 row(s) in 0.0520 second

to insert value

 hbase(main):004:0> put 'testtable', 'myrow-1', 'colfam1:q1', 'value-1'
    0 row(s) in 0.1020 seconds
    hbase(main):005:0> put 'testtable', 'myrow-2', 'colfam1:q2', 'value-2'
    0 row(s) in 0.0410 seconds
    hbase(main):006:0> put 'testtable', 'myrow-2', 'colfam1:q3', 'value-3'
    0 row(s) in 0.0380 seconds

to see the table contain

hbase(main):007:0> scan 'testtable'
ROW        COLUMN+CELL   
myrow-1    column=colfam1:q1, timestamp=1297345476469, value=value-1
myrow-2    column=colfam1:q2, timestamp=1297345495663, value=value-2
myrow-3    column=colfam1:q3, timestamp=1297345508999, value=value-3