Aarav
Aarav

Reputation: 111

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.

Upvotes: 0

Views: 734

Answers (1)

Anil Gupta
Anil Gupta

Reputation: 1126

You rowkey is "4000001" not "ROW".

Upvotes: 1

Related Questions