2015-02-17 58 views
0

的Python API中的行密钥我有以下形式的HBase的表(customers):不理解在HBASE

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表中获取数据?谢谢。

回答

1

你的rowkey是“4000001”而不是“行”。