https://github.com/wgzhao/easybase
Developer-friendly Python library to interact with Apache HBase, supports time range scan and multi-versions
https://github.com/wgzhao/easybase
easybase happybase hbase python thriftpy2 timerange
Last synced: 2 months ago
JSON representation
Developer-friendly Python library to interact with Apache HBase, supports time range scan and multi-versions
- Host: GitHub
- URL: https://github.com/wgzhao/easybase
- Owner: wgzhao
- License: other
- Created: 2016-06-03T05:42:59.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-09T09:03:43.000Z (about 2 years ago)
- Last Synced: 2025-03-18T02:44:36.029Z (3 months ago)
- Topics: easybase, happybase, hbase, python, thriftpy2, timerange
- Language: Python
- Homepage:
- Size: 226 KB
- Stars: 18
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.rst
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
EasyBase
========.. image:: https://github.com/wgzhao/easybase/actions/workflows/python-package.yml/badge.svg
:target: https://github.com/wgzhao/easybase.. image:: https://img.shields.io/pypi/dm/easybase.svg
:target: https://pypi.org/project/easybase/.. image:: https://img.shields.io/pypi/v/easybase.svg
:target: https://pypi.org/project/easybase/.. image:: https://img.shields.io/pypi/pyversions/easybase.svg
:target: https://pypi.org/project/easybase/.. image:: https://img.shields.io/pypi/implementation/easybase.svg
:target: https://pypi.org/project/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 thriftpyInstallation
============.. code:: shell
pip install easybase
Usage
=====Connect
-------.. code:: python
import easybase
host, port = 'localhost', 9000
tbl = 'test1'
conn = easybase.Connection(host=host, port=port)
table = conn.table(tbl)
rs = conn.scan(limit=10)
for row in rs:
print(row)Create Table
------------.. 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
tbl = conn.table('test1')
scanner = tbl.scan(row_start='rk_0001', row_stop='rk_0100')
for row in scanner:
print(row)Get all namespace
------------------.. code:: python
for ns in conn.list_namespaces():
print(ns)You can get detail in
`DemoClient.py `__License
=================
MIT License ``_.