happyhbase 文档地址
注意:
创建 连接时注意兼容,通过参数 compat
设置兼容级别(默认 0.98, thrift 的版本),具体看这里https://happybase.readthedocs.io/en/latest/api.html#connection
import happybase
import time
hbase = happybase.Connection(host='192.168.1.193', port=9090, compat='0.92')
test_table = hbase.table('test', use_prefix=False)
hbase.delete_table('test', disable=True) # 删除表
hbase.create_table('test', {
# 创建表
'cf1': dict(bloom_filter_type='ROWCOL'),
'cf2': dict(bloom_filter_type='ROWCOL'),
'cf3': dict(bloom_filter_type='ROWCOL')
})
test_table = hbase.table('test', use_prefix=False) # 获取表
print('table families', test_table.families()) # 输出所有列族
print('table regions', test_table.regions(