Hbase REST API client built using uplink
Project description
hbase
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
- Uplink - A Declarative HTTP Client for Python
- HBase REST API documentation - Used to help build out the package
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.