Python 连接 Hbase happybase

网友投稿 793 2022-11-11

Python 连接 Hbase happybase

Python 连接 Hbase happybase

1. 安装thrift

brew install thrift

2.启动thrift

./hbase-daemon.sh start thrift

3.安装依赖python 库

pip install thrift pip install hbase-thrift pip install happybase

这边用的是happybase 这个库,去这了解更多。

import happybase#连接connection = happybase.Connection('localhost')connection.open()# connection.create_table('mytable', {'name' : dict(max_versions=5), 'course':dict()})#打印所有的表print(connection.tables())table = connection.table('Score')row = table.row(b'95001')print(row[b'course:Math'])#插入数据table.put(b'95002', {b'course:Math':b'65', b'course:English':b'77'})

​​http://codeblogbt.com/archives/146821​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:python 单元测试
下一篇:spark window 的使用
相关文章

 发表评论

暂时没有评论,来抢沙发吧~