簡體   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