Mat*_*sen 5 python hive thrift python-2.7
from pyhive import hive
import thrift_sasl
connection = hive.Connection(host='myhost', port=10000, database='local')
#hangs here
from sqlalchemy import create_engine
engine = create_engine('hive://myhost:10000/local')
logs = Table('mytable', MetaData(bind=engine), autoload=True)
#also hangs here
Run Code Online (Sandbox Code Playgroud)
这两个片段都对我来说很重要。
点击 ctrl+c 将停止执行:
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/apps/Python/lib/python2.7/site-packages/pyhive/hive.py", line 86, in __init__
self._transport.open()
File "thrift_sasl.py", line 74, in open
status, payload = self._recv_sasl_message()
File "thrift_sasl.py", line 92, in _recv_sasl_message
header = self._trans.readAll(5)
File "/apps/Python/lib/python2.7/site-packages/thrift/transport/TTransport.py", line 58, in readAll
chunk = self.read(sz - have)
File "/apps/Python/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 105, in read
buff = self.handle.recv(sz)
KeyboardInterrupt
Run Code Online (Sandbox Code Playgroud)
我正在使用 Hive 0.12 和 HiveServer2。我可以使用 Hadoop 提供的 python Hive 库 (.../hive/lib/py) 连接到它,但不能使用使用 thrift_sasl 的 pyhive 进行连接。
一些不使用 thrift_sasl 模块的人建议关闭hive-site.xmlvia 中的 SASL 支持:
<property><name>hive.server2.authentication</name><value>NOSASL</value></property>
Run Code Online (Sandbox Code Playgroud)
然而,在尝试此操作之后,当我发出KeyboardInterrupt.