-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,90 @@ | ||
EasyBase | ||
======== | ||
|
||
**HappyBase** is a developer-friendly Python library to interact with | ||
Apache HBase. But it not support Thrift 2 protocol. So I fork it and try | ||
to support Thrift 2 and name to **EasyBase** | ||
**EasyBase** is a developer-friendly Python library to interact with | ||
`Apache HBase <https://hbase.apache.org>`__ . The orignal source code | ||
forked from `HappyBase <https://github.com/wbolster/happybase>`__. | ||
|
||
|
||
Feature highlight | ||
================= | ||
|
||
- easy using | ||
|
||
- support HBase Thrift 2 protocol | ||
|
||
- using `thriftpy2 <http://github.com/thriftpy/thriftpy2>`__ instead of | ||
old thriftpy | ||
|
||
HBase thrift 2 cut all DDL schema and merge almost row manipulation. It | ||
mainly support put,get and scan function. | ||
|
||
Installation | ||
============ | ||
|
||
.. code:: shell | ||
pip install easybase | ||
Usage | ||
===== | ||
|
||
|
||
Connect | ||
------- | ||
|
||
.. code:: python | ||
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 | ||
------------ | ||
|
||
``pip install easybase`` | ||
.. code:: python | ||
table_def = {'cf1':dict(), | ||
'cf2':{'max_versions':2000}} | ||
conn.create_table('test1', table_def) | ||
Write row to table | ||
------------------ | ||
|
||
.. code:: python | ||
puts = {'cf1:c1': 'v1', | ||
'cf1:c2': 'v2' | ||
'cf2:c2': 'v3'} | ||
tbl = conn.table('test1') | ||
tbl.put(row='rk1', puts) | ||
Get row from table | ||
------------------ | ||
|
||
.. code:: python | ||
rk = 'rk1' | ||
tbl = conn.table('test1') | ||
rs = tbl.row(rk) | ||
Scan rows | ||
---------- | ||
|
||
.. code:: python | ||
Demo | ||
---- | ||
tbl = conn.table('test1') | ||
scanner = tbl.scan(row_start='rk_0001', row_stop='rk_0100') | ||
for row in scanner: | ||
print(row) | ||
you can view ``DemoClient.py`` to get detail. | ||
You can get detail in | ||
`DemoClient.py <https://github.com/wgzhao/easybase/blob/master/DemoClient.py>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
setup.py. | ||
""" | ||
|
||
__version__ = '0.6' | ||
__version__ = '1.0' |