简体   繁体   中英

Not understanding the row-key in Python API of Hbase

I have a hbase table ( customers ) in the following form:

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 

I tried to extract these data using 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 

It prints table.families() as:

{'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}}

But it prints {}, nothing, in row. I am just confused about my understanding row-key value in hbase table. Do have any suggestion how to get data from hbase table using python API?. Thanks.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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