程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python reads a field in the table of HBase (happybase)

編輯:Python

stay Centos7 Tests done in the environment ,python3,hbase1.2.4,happybase,

Python read out Hbase A field in the table of (happybase) Then print it out on the console .

1. Import and stock in

The code is as follows ( Example ):

import happybase

2. Get ready Hbase Table of (t11) The data of

3. Read in Hbase The data of Python Code

The code is as follows ( Example ):

import happybase
connection = happybase.Connection('192.168.113.201', port=9090)
connection.open()
table = connection.table('t11')
#f1 Of row1 The content output of
row = table.row('row1', columns=['f1'])
print("---------------------")
for key, value  in row.items():
# The fields in the same row are cycled
    if (key.decode("utf8") == 'f1:name') :
    #name The occasion of , Output name
        print(value.decode("utf8"))  

4. Running results


Thank you for reading , Hope to save your time .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved