简体   繁体   English

使用 pyhive 和 pyodbc 从 Windows 连接到 hive

[英]Connecting to hive from windows using pyhive and pyodbc

Hi I want to connect to hive using python libraries pyhive and pyodbc:嗨,我想使用 python 库 pyhive 和 pyodbc 连接到 hive:

     conn = hive.Connection(host="hostname",port=10001,username="********",database="default",auth='KERBEROS',kerberos_service_name="hive")

the error I am getting我得到的错误

     TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'

And When I am using pyodbc then当我使用 pyodbc 然后

conn_string="""DSN=%s; Host=%s, Port=%d, Database=default; AuthMech=3;UseSASL=1; UID=%s; PWD=%s; SSL=1;AllowSelfSignedServerCert=1"""% (cfg['DSN'], cfg['host'], cfg['port'],cfg['username'], cfg['password'])

conn = pyodbc.connect(conn_string, autocommit=True)

This is the error I am getting so Please if anyone who has been successful in connecting python with hive by pyodbc, pyhive Please Help这是我遇到的错误,请如果有人成功通过pyodbc,pyhive将python与hive连接,请帮助

Hive is hosted in Cloudera. Hive 托管在 Cloudera 中。

pyhive needs sasl dependencies pyhive 需要 sasl 依赖项

on linux install by yum/apt在 linux 上通过 yum/apt 安装

on windows after install package cyrus-sasl, need to configure sasl2 directory在windows上安装cyrus-sasl包后,需要配置sasl2目录
located site-packages/sasl or Library/bin/位于site-packages/saslLibrary/bin/

method 1: copy sasl2 folder to C:\\CMU\\bin\\方法一:复制sasl2文件夹到C:\\CMU\\bin\\

method 2: add registry string方法二:添加注册表字符串

HKEY_LOCAL_MACHINE\SOFTWARE\Carnegie Mellon\Project Cyrus\SASL Library\SearchPath
C:\Users\cdarling\Miniconda3\envs\hive\Library\bin\sasl2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM