Skip to content
forked from wgzhao/easybase

Developer-friendly Python library to interact with Apache HBase, supports time range scan and multi-versions

License

Notifications You must be signed in to change notification settings

rmekdma/easybase

 
 

Repository files navigation

EasyBase

EasyBase is a developer-friendly Python library to interact with Apache HBase . The original source code forked from HappyBase.

Feature highlight

  • easy using
  • support HBase Thrift 2 protocol(HBase Thrift 1 is NO longer supported)
  • using thriftpy2 instead of old thriftpy

Installation

pip install easybase

Usage

Connect

import easybase
host, port = 'localhost', 9000
tbl = 'test1'
conn = easybase.connect(host=host, port=port)
table = conn.table(tbl)
rs = conn.scan(limit=10)
for row in rs:
  print(row)

Create Table

table_def = {'cf1':dict(),
             'cf2':{'max_versions':2000}}
conn.create_table('test1', table_def)

Write row to table

puts = {'cf1:c1': 'v1',
        'cf1:c2': 'v2'
       'cf2:c2': 'v3'}
tbl = conn.table('test1')
tbl.put(row='rk1', puts)

Get row from table

rk = 'rk1'
tbl = conn.table('test1')
rs = tbl.row(rk)

Scan rows

tbl = conn.table('test1')
scanner = tbl.scan(row_start='rk_0001', row_stop='rk_0100')
for row in scanner:
  print(row)

Get all namespace

for ns in conn.list_namespaces():
     print(ns)

You can get detail in DemoClient.py

License

MIT License http://www.opensource.org/licenses/MIT.

About

Developer-friendly Python library to interact with Apache HBase, supports time range scan and multi-versions

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 72.9%
  • Thrift 25.7%
  • Other 1.4%