繁体   English   中英

不了解Hbase的Python API中的行键

[英]Not understanding the row-key in Python API of Hbase

我有以下形式的hbase表( customers ):

hbase(main):004:0> scan 'customers'

ROW                                                          COLUMN+CELL                                                                                                                                             
 4000001                                             column=customers_data:age, timestamp=1424123059769, value=55                                                                                            
 4000001                                             column=customers_data:firstname, timestamp=1424123059769, value=Kristina                                                                                
 4000001                                             column=customers_data:lastname, timestamp=1424123059769, value=Chung                                                                                    
 4000001                                             column=customers_data:profession, timestamp=1424123059769, value=Pilot 

我试图使用python API http://happybase.readthedocs.org/en/latest/提取这些数据:

import happybase


connection = happybase.Connection('localhost',autoconnect=False)


connection.open()


table = connection.table('customers')


print table.families()


row = table.row('ROW')


print row 

它将table.families()打印为:

{'customers_data': {'block_cache_enabled': True,

  'bloom_filter_nb_hashes': 0,

  'bloom_filter_type': 'ROW',

  'bloom_filter_vector_size': 0,

  'compression': 'NONE',

  'in_memory': False,

  'max_versions': 1,

  'name': 'customers_data:',

  'time_to_live': 2147483647}}

但它会连续输出{},但不输出任何内容。 我只是对我对hbase表中行键值的理解感到困惑。 有什么建议如何使用python API从hbase表中获取数据吗? 谢谢。

您的行键是“ 4000001”而不是“ ROW”。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM