python 连接Impala相关问题
安装相应的包
参考这篇:http://www.mamicode.com/info-detail-1843724.html
我的python是3.6版本,自己选择相应的包下载
报错解决
上面装完不出意外运行会报错:
impyla (0.14.0) ERROR - 'TSocket' object has no attribute 'isOpen'
解决办法如下(降低包版本):
pip uninstall thrift-sasl
pip uninstall impyla
pip uninstall thrift
pip install thrift-sasl==0.2.1
pip install thrift==0.9.3
pip install impyla==0.13.8
然后发现又会报另外的错误:
TTransportException: TTransportException(type=1, message="Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'")
解决办法为将如下(安装纯净版的sasl):
pip uninstall sasl
pip install pure-sasl
最后一个错误:
File "C:\Users\dongyukang421\Anaconda3\Python36\lib\site-packages\thrift_sasl\__init__.py", line 94, in _send_message
self._trans.write(header + body)
TypeError: can't concat str to bytes
解决办法:
在报错的文件第94行添加一个判断: