方法一:记录单独执行

Python操作hbase,通过phoenixdb

import argparse
sys.path.append("/opt/anaconda3/lib/python3.5/site-packages/phoenixdb")
import phoenixdb
import phoenixdb.cursor
url = 'http://192.168.14.101:8765/'
conn = phoenixdb.connect(url, autocommit=True)
cursor = conn.cursor()
cursor.execute("SELECT * FROM test")
records = cursor.fetchall()
for record in records:
	print(record)

方法二:R下连接hbase通过执行

R语言通过reticulate包,使用source_python加载Py脚本,链接hbase

import phoenixdb
import phoenixdb.cursor

url = 'http://192.168.14.101:8765/'
conn = phoenixdb.connect(url, autocommit=True)

cursor = conn.cursor()
cursor.execute("SELECT * FROM test")
records = cursor.fetchall()
for record in records:
    print(record)

R语言和Python连接hbase的phoneix映射_Python开发