Skip to main content

Hbase REST API client built using uplink

Project description

hbase

Coverage Docs PyPI Latest Release
License Code style: black

Hbase REST API client built using uplink

Main Features

  • A transparent and user friendly HBase REST API client
  • Easy to extend by subclassing and utilizing uplink's Consumer class
  • A great alternative to HBase Thrift client

Installation

$ pip install hbase

---> 100%

Usage

Build an instance to interact with the web service, check out the HBase client reference for a full list of available methods.

from hbase import HBase

hbase = HBase(base_url="http://localhost:8000")

Then, executing an HTTP request is as simply as invoking a method.

# Get all rows using the wildcard, or supply exact row_id for single row
hbase.get_row(table="example_table", row_id="*")

The returned object is a friendly Pydantic model which will automatically decode the response from base64:

CellSet(
    Row=[
        Row(
            key="decoded_key", 
            Cell=[
                Cell(
                    column="decoded_column", 
                    timestamp=39082034, 
                    value="decoded_value"
                ), 
                ...
            ]
        ), 
    ...]
)

Similarly you can perform other CRUD operations on HBase, such as inserting a row, note that the data will automatically be encoded into base64 for you free of charge!

hbase.insert_rows(
    test_table_name, 
    rows={
        "row-1": {
            "col1": "dat1", 
            "col2": "dat2"
        }, 
        "row-2": {
            "col1": "dat1", 
            "col2": "dat2"
        }
    }
)
hbase.insert_row(
    test_table_name, 
    row_id="row-3", 
    column_data={
        "col1": "dat1", 
        "col2": "dat2"
    }
)

For sending non-blocking requests, HBase uses Uplink, which comes with support for aiohttp and twisted.

Credits

License

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-1.0.0.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

hbase-1.0.0-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

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