环境:Centos6.5 python2.7
1、下载并安装Python package:impyla-0.14.0.tar.gz
https://pypi.python.org/packages/6c/30/da9fe733561eb948a07aaef3ae0240ac6a5466cfea5e6872525515634544/impyla-0.14.0.tar.gz
python setup.py install
或者pip install impyla
2、python客户端与impala交互
连接impala:部署的ip--hive,默认端口:21050
from impala.dbapi import connect
conn = connect(host='192.168.0.10', port=21050)
cur = conn.cursor()
cur.execute('select name as num from user ;')
data_list=cur.fetchall()
for data in data_list:
#用户列表
print "用户名称:",data