Database Reference
In-Depth Information
Figure 7.3 Describing the table attributes.
Notice the two column family groups. You can also set attributes for the
table/column groups (for example, the number of versions to keep and
whether to keep deleted cells).
Now that you've created your table, you're ready to load data into it.
Loading Data into an HBase Table
You can load data into the table in two ways. To load a single value, you use
the put command, supplying the table, column, and value. The column is
prefixed by the column family. The following code loads a row of stock data
into the Stocks table:
put 'Stocks', 'ABXA_12092009','Price:Open','2.55'
put 'Stocks', 'ABXA_12092009','Price:High','2.77'
put 'Stocks', 'ABXA_12092009','Price:Low','2.5'
put 'Stocks', 'ABXA_12092009','Price:Close','2.67'
put 'Stocks', 'ABXA_12092009','Trade:Volume','158500'
To verify that the values have been loaded in the table, you can use the scan
command:
scan 'Stocks'
You should see the key/values listed as shown in Figure 7.4 . Notice a
timestamp has been automatically loaded as part of the key to keep track of
versioning.
 
 
Search WWH ::




Custom Search