linux下python连接hive,如何使用python pyhs2连接到hive?

您所在的位置:网站首页 四川七藏沟旅游 linux下python连接hive,如何使用python pyhs2连接到hive?

linux下python连接hive,如何使用python pyhs2连接到hive?

2024-03-13 14:08| 来源: 网络整理| 查看: 265

我正在尝试使用pyhs2访问配置单元。我尝试了以下代码:

示例.pyimport pyhs2

conn = pyhs2.connect(host='localhost', port=10000,authMechanism=None, user=None, password=None,database='default')

with conn.cursor() as cur:

cur.execute("select * from table")

for i in cur.fetch():

print i

我得到以下错误:Traceback (most recent call last):

File "example.py", line 2, in conn = pyhs2.connect(host='localhost', port=10000,authMechanism=None, user=None, password=None,database='default')

File "build/bdist.linux-x86_64/egg/pyhs2/__init__.py", line 7, in connect

File "build/bdist.linux-x86_64/egg/pyhs2/connections.py", line 46, in __init__

File "build/bdist.linux-x86_64/egg/pyhs2/cloudera/thrift_sasl.py", line 55, in open

File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 101, in open

thrift.transport.TTransport.TTransportException: Could not connect to localhost:10000

当我尝试使用hive-utils时,我得到了准确的错误。我已经检查过sasl的安装。我需要更改配置单元中的hive-site.xml吗?如果是,我需要在哪里创建它?我错过了什么吗?



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3