DML Commands

count  
Count the number of rows in a table. This operation may take a LONG time (Run 
'$HADOOP_HOME/bin/hadoop jar hbase.jar rowcount' to run a counting mapreduce job). Current count 
is shown every 1000 rows by default. Count interval may be optionally specified. Examples:

hbase> count 't1'
hbase> count 't1', 100000
 
delete 
Put a delete cell value at specified table/row/column and optionally timestamp coordinates. 
Deletes must match the deleted cell's coordinates exactly.  When scanning, a delete cell 
suppresses older versions. Takes arguments like the 'put' command described below.
 
deleteall 
Delete all cells in a given row; pass a table name, row, and optionally a column and timestamp.
 
get 
Get row or cell contents; pass table name, row, and optionally a dictionary of column(s), 
timestamp and versions.  Examples: 

hbase> get 't1', 'r1'
This will return all the columns for the particular row key r1 in table t1.
hbase> get 't1', 'r1', {TIMERANGE => [ts1, ts2]}
hbase> get 't1', 'r1', {COLUMN => 'c1'}
This will return the column c1 for rowkey r1 in table t1
hbase> get 't1', 'r1', {COLUMN => ['c1', 'c2', 'c3']}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMERANGE => [ts1, ts2], VERSIONS => 4}
hbase> get 't1', 'r1', {COLUMN => 'c1', TIMESTAMP => ts1, VERSIONS => 4}
hbase> get 't1', 'r1', 'c1'
hbase> get 't1', 'r1', 'c1', 'c2'
hbase> get 't1', 'r1', ['c1', 'c2']
 
get_counter
Return a counter cell value at specified table/row/column coordinates.
A cell cell should be managed with atomic increment function oh HBase
and the data should be binary encoded. Example:
hbase> get_counter 't1', 'r1', 'c1'

incr
Increments a cell 'value' at specified table/row/column coordinates.
To increment a cell value in table 't1' at row 'r1' under column
'c1' by 1 (can be omitted) or 10 do:

  hbase> incr 't1', 'r1', 'c1'
  hbase> incr 't1', 'r1', 'c1', 1
  hbase> incr 't1', 'r1', 'c1', 10

put 
Put a cell 'value' at specified table/row/column and optionally timestamp coordinates. 
To put a cell value into table 't1' at row 'r1' under column 'c1' marked with the time 'ts1', do: 

hbase> put 't1', 'r1', 'c1', 'value', ts1
 
scan 
Scan a table; pass table name and optionally a dictionary of scanner specifications.  Scanner 
specifications may include one or more of the following: LIMIT, STARTROW, STOPROW, TIMESTAMP, 
or COLUMNS.  If no columns are specified, all columns will be scanned.  To scan all members of a 
column family, leave the qualifier empty as in 'col_family:'.  Examples:
 
hbase> scan '.META.'
hbase> scan '.META.', {COLUMNS => 'info:regioninfo'}
hbase> scan 't1', {COLUMNS => ['c1', 'c2'], LIMIT => 10, STARTROW => 'xyz'}
hbase> scan 't1', {FILTER =>  org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(1, 0)}
hbase> scan 't1', {COLUMNS => 'c1', TIMERANGE => [1303668804, 1303668904]}

scan 'tablename'
This will return all table columns and there latest values.

scan 'tablename',{COLUMNS=>'cf:colname1,cf:colname2'} 
This will return latest values for these two columns only.
 
scan 'tablename',{COLUMNS=>'cf:colname',VERSIONS=>100} 
This will return all the 100 versions for the corresponding column.  

truncate 
Disables, drops and recreates the specified table

Comments

Popular posts from this blog

Configure FAIR Schedular in Spark

How to store a complex class object in hbase .......

Redis Quick Start Guide