gpt4 book ai didi

python - 我如何连接到 presto pyhive?

转载 作者:太空宇宙 更新时间:2023-11-04 06:41:14 25 4
gpt4 key购买 nike

我想在 zeppelin 中使用 pyhive 连接 presto

现在,我关注 https://github.com/dropbox/PyHive

我使用了连接函数并更正了参数。

%python
from pyhive import presto
cursor = presto.connect(host='localhost',
port=10000,
username='id:password').cursor()
cursor.execute('SELECT * FROM table LIMIT 10')

但它不起作用。

Traceback (most recent call last):
File "/tmp/zeppelin_python-557261260901431465.py", line 278, in <module>
raise Exception(traceback.format_exc())
Exception: Traceback (most recent call last):
File "/tmp/zeppelin_python-557261260901431465.py", line 266, in <module>
exec(code)
File "<stdin>", line 5, in <module>
File "/usr/lib/python2.7/dist-packages/pyhive/presto.py", line 206, in execute
self._process_response(response)
File "/usr/lib/python2.7/dist-packages/pyhive/presto.py", line 263, in _process_response
response_json = response.json()
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 650, in json
return json.loads(self.content.decode(encoding), **kwargs)
File "/usr/lib64/python2.7/encodings/utf_32_le.py", line 11, in decode
return codecs.utf_32_le_decode(input, errors, True)
UnicodeDecodeError: 'utf32' codec can't decode bytes in position 4-7: code point not in range(0x110000)

我该如何解决?

最佳答案

您是否尝试过将用户名和密码分开?presto.connect(host='xxx', port=xxx, username='xxx', password='xxx')对我有用。

关于python - 我如何连接到 presto pyhive?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46293564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com