Project

hbaserb

0.02
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Ruby HBase library using Thrift
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.4.0
 Project Readme

hbaserb – HBase Thrift interface for Ruby¶ ↑

A Ruby thrift lib for interfacing with Hadoop’s HBase 0.92.0

To install:

gem install hbaserb

Basic Usage¶ ↑

require 'rubygems'
require 'hbaserb'

client = HBaseRb::Client.new 'localhost'

# create table with two column families
table = client.create_table "test_table", "colfamone", "colfamtwo"

# insert some data
table.mutate_row 'myrow', {'colfamone:myvalue' => 'awesome value'}

# delete some data
table.mutate_row 'myrow', {'colfamone:myvalue' => nil}

# get it
puts t.get('myrow', 'colfamone:myvalue').first.value

# get timestamp
puts t.get('myrow', 'colfamone:myvalue').first.timestamp

# convert binary value to 64 bit integer
t.atomic_increment('myrow', 'colfamtwo:counter')
puts t.get('myrow', 'colfamtwo:counter').first.to_i64

# make a scanner
s = t.create_scanner('my-start-row', 'my-end-row', 'colfamnone') { |row|
  puts "Columns: #{row.columns.keys}"
}