环境
CentOS7 & Python 3.6.6
安装impyla及其相关依赖,注意版本号
版本号不对,可能会造成错误
pip install -r requirement.txt
requirement.txt
impyla==0.14.1
bitarray==0.8.1
six==1.11.0
thrift==0.11.0
thrift-sasl==0.2.1
thriftpy==0.3.9
安装完成后测试
from impala.dbapi import connect
conn = connect(host='IP地址', auth_mechanism="PLAIN", port=21050, user="XXX", password="XXX")
cur = conn.cursor()
res = cur.execute('select now()')
发现运行到第二行就报错了
thriftpy.transport.TTransportException: TTransportException(type=1, message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: No worthy mechs found'")
看报错信息,分析下来应该是和auth_mechanism机制有关,在网上搜索,在git