发布时间:2019-09-07 07:58:59编辑:auto阅读(3959)
环境: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
上一篇: 解析python 命令的-u参数
下一篇: python保存列表
47863
46424
37314
34759
29331
25990
24945
19966
19563
18050
5806°
6433°
5946°
5975°
7079°
5925°
5963°
6456°
6417°
7798°