Permalink
Browse files

Examples for reading and writing rows

  • Loading branch information...
alindeman committed Feb 17, 2012
1 parent 9baf895 commit c4f0ef10b887bcaab85bac3ee0c84b438f938d66
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.md
View
@@ -64,6 +64,25 @@ client = HBase::Client.new(protocol)
puts client.getTableNames
```
+## Writing Rows
+
+```ruby
+# Assuming a table "mytable" and a column family "c"
+client.mutateRow("mytable", "abc123", [HBase::Mutation.new(column: "c:foo", value: "bar")])
+```
+
+## Reading Rows
+
+```ruby
+# Assuming a table "mytable" and a column family "c"
+results = client.getRow("mytable", "abc123")
+if result = results.first
+ result.columns.each do |key, cell|
+ puts "#{key}: #{cell.value}"
+ end
+end
+```
+
## API Reference
* [Hbase/ThriftApi](http://wiki.apache.org/hadoop/Hbase/ThriftApi)

0 comments on commit c4f0ef1

Please sign in to comment.