有没有知道happybase的?就是python访问hbase,我想问问能不能筛选某一列等于特定值的行并打印出来

0
已邀请:
0

牟瑞 - 大数据 Hadoop 讲师 Hadoop入门课程地址:http://www.hellobi.com/course/39 有架构师,技术总监,CTO的职位请联系我! 2015-09-25 回答

虽然没用过happybase,但是这种方式应该可以的啊。还有问题继续留言,我给你解答
import happybase

connection = happybase.Connection('hostname')
table = connection.table('table-name')

table.put('row-key', {'family:qual1': 'value1',
'family:qual2': 'value2'})

row = table.row('row-key')
print row['family:qual1'] # prints 'value1'

for key, data in table.rows(['row-key-1', 'row-key-2']):
print key, data # prints row key and data for each row

for key, data in table.scan(row_prefix='row'):
print key, data # prints 'value1' and 'value2'

 

要回复问题请先登录注册