Skip to main content

Python/Python3 library to interact with Apache HBase,support HBase 2.0, time-range scan and HBase thrift 2 procotol.

Project description

EasyBase

https://github.com/wgzhao/easybase/workflows/Test/badge.svg https://img.shields.io/pypi/dm/easybase.svg https://img.shields.io/pypi/v/easybase.svg https://img.shields.io/pypi/pyversions/easybase.svg https://img.shields.io/pypi/implementation/easybase.svg

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for easybase, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size easybase-1.1.0-py2.py3-none-any.whl (31.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size easybase-1.1.0.tar.gz (31.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page