Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on 07-26-2017 04:29 AM - edited 09-16-2022 04:59 AM
Hi ,
using Ubuntu 14.0.4 and 16.0.4 unable to work with Impala via Python .
Installed :
pip install impyla
apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
pip install thrift_sasl
pip install sasl
thrift version install :
thrift (0.10.0)
thrift-sasl (0.2.1)
impyla (0.14.0)
The Example Code
------------------------------
from impala.dbapi import connect
conn = connect(host="104.198.200.187", port="25003", user="user", password='pass', auth_mechanism='PLAIN')
print "Connected Successfully"
cur = conn.cursor()
--------------------------------------------------------------------------------
stack error :
Traceback (most recent call last):
File "/home/alon/PycharmProjects/test/test.py", line 6, in <module>
cur = conn.cursor()
File "/usr/local/lib/python2.7/dist-packages/impala/hiveserver2.py", line 125, in cursor
session = self.service.open_session(user, configuration)
File "/usr/local/lib/python2.7/dist-packages/impala/hiveserver2.py", line 995, in open_session
resp = self._rpc('OpenSession', req)
File "/usr/local/lib/python2.7/dist-packages/impala/hiveserver2.py", line 923, in _rpc
response = self._execute(func_name, request)
File "/usr/local/lib/python2.7/dist-packages/impala/hiveserver2.py", line 940, in _execute
return func(request)
File "/usr/local/lib/python2.7/dist-packages/impala/_thrift_gen/TCLIService/TCLIService.py", line 175, in OpenSession
return self.recv_OpenSession()
File "/usr/local/lib/python2.7/dist-packages/impala/_thrift_gen/TCLIService/TCLIService.py", line 193, in recv_OpenSession
result.read(self._iprot)
File "/usr/local/lib/python2.7/dist-packages/impala/_thrift_gen/TCLIService/TCLIService.py", line 1109, in read
fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
AttributeError: 'TSaslClientTransport' object has no attribute 'trans'
dont know what is going wrong here .
Thanks
Alon
Created 07-26-2017 04:40 AM
Solved the problem by reinstalling thrift and impyla with the following versions:
as root :
pip uninstall thrift
pip uninstall impyla
pip install thrift==0.9.3
pip install impyla==0.13.8
Regards
Alon
Created 07-26-2017 04:40 AM
Solved the problem by reinstalling thrift and impyla with the following versions:
as root :
pip uninstall thrift
pip uninstall impyla
pip install thrift==0.9.3
pip install impyla==0.13.8
Regards
Alon
Created 06-27-2018 05:32 AM
Was getting this issue in Airflow trying to use HiveServer2Hook:
ImportError: cannot import name TFrozenDict
And figured it might be related to this pip warning:
impyla 0.14.1 has requirement thrift<=0.9.3, but you'll have thrift 0.11.0 which is incompatible.
So I adjusted the thrift and impyla installs as indicated and now HiveServer2Hook works (and HiveOperator still works)--both of which are using kerberos beeline connections.
Thanks for posting the fix.