如何使用JDBC连接连接python和配置单元

2024-10-01 00:32:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用python连接hive,只在JDBC连接上使用python。我已经尝试了pyhive它工作得很好,但是我需要使用JDBC连接将python与hive连接起来。在

我尝试下面的代码使用JDBC连接将python与hive连接起来

import jaydebeapi

def get_hive_jdbc_con():
    driver="org.apache.hive.jdbc.HiveDriver"
    conn_url="jdbc:hive2://system101.xxx.com:10000/default".format(host="system101.xxx.com",port=10000)
    auth_lst=["hive","hive"]
    conn = jaydebeapi.connect(driver,conn_url,auth_lst,)
    return conn

if __name__ == '__main__':
    get_hive_jdbc_con()

我得到了这个错误

^{pr2}$

Tags: comauthurlgetdriverconnconxxx