Skip to main content

No project description provided

Project description

hbase-driver

Native Hbase driver in Python. (No thrift)

Introduction

  • written in pure Python
  • native HBase protocol support (HBase 2.X+)
  • Support both admin operations and regionserver calls.

Installation (pip)

pip3 install hbase-driver

Get Started

from hbasedriver.client import Client
from hbasedriver.operations import Put, Get, Scan
from hbasedriver.exceptions.RemoteException import TableExistsException

# lets say your hbase instance runs on 127.0.0.1 (zk quorum address)
client = Client(["127.0.0.1"])
try:
    client.create_table("", "mytable", ['cf1', 'cf2'])
except TableExistsException:
    pass
table = client.get_table("", "mytable")
table.put(Put(b'row1').add_column(b'cf1', b'qf', b'666'))
table.put(Put(b'row1').add_column(b'cf1', b'qf2', b'999'))
table.put(Put(b'row1').add_column(b'cf2', b'qf', b'777'))
table.put(Put(b'row2').add_column(b'cf1', b'qf123', b'777'))
result = table.get(Get(b"row1").add_column(b'cf1', b'qf'))
print("get result =", result)
assert b'666' == result.get(b'cf1', b'qf')

scan_result = table.scan(Scan(b"row1").add_family(b'cf1'))
# retrieve all results from the iterator.
scan_result = list(scan_result)
print("scan result below:")
for row in scan_result:
    print(row)

Master (metadata) operations

from hbasedriver.client import Client

client = Client(["127.0.0.1"])
# describe table
res = client.master.describe_table(None, "mytable")
print(res)
# table_name {
#     namespace: "default"
#     qualifier: "test_table_master"
#   }
#   attributes {
#     first: "IS_META"
#     second: "false"
#   }
#   attributes {
#     first: "hbase.store.file-tracker.impl"
#     second: "DEFAULT"
#   }
#   column_families {
#     name: "cf1"
#     attributes {
#       first: "INDEX_BLOCK_ENCODING"
#       second: "NONE"
#     }
# ..........

Implemented

  • Create, Disable, Delete table
  • Put
  • Get
  • DELETE
  • Scan

TODOs

  • Filters
  • More params in the operations.

Project details


Download files

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

Source Distribution

hbase-driver-0.0.12.tar.gz (101.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hbase_driver-0.0.12-py3-none-any.whl (148.5 kB view details)

Uploaded Python 3

File details

Details for the file hbase-driver-0.0.12.tar.gz.

File metadata

  • Download URL: hbase-driver-0.0.12.tar.gz
  • Upload date:
  • Size: 101.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for hbase-driver-0.0.12.tar.gz
Algorithm Hash digest
SHA256 fc863e4b1714e3167a7452771121dbe98b1da4dec70d4f2bf85f679666923a03
MD5 c2d3f740b8a4f9da9736f1893e8687d4
BLAKE2b-256 dbe05c0f36adec64b620ff3adf0518401b49a2a0d01609fbbf77ae2393770bb0

See more details on using hashes here.

File details

Details for the file hbase_driver-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: hbase_driver-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 148.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for hbase_driver-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 d40d4a7295f2d450711249f5b29072573893f5b536765a5422ee8de2d822cc66
MD5 bcb4fbd8d3587edf3de39b83eea31f2f
BLAKE2b-256 4730f52676afbd61c32cf317c6ddcdd55194a37582acb5d056896701e7f6f503

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page