我在尝试创建与HiveServer的连接时收到以下错误
回溯(最近一次调用最后一次):文件"/Users/user_name/Desktop/ABCo/EEM/EntityManagement/lodurr/data_lake/hive_db.py",第56行,在包装器中auth_mechanism ='PLAIN')文件"/ Users/user_name/.virtualenvs/entity1/lib/python3.6/site-packages/impala/dbapi.py",第147行,连接auth_mechanism = auth_mechanism)文件"/Users/user_name/.virtualenvs/entity1/lib/python3.6/site -packages /帕拉/ hiveserver2.py",线路758,在连接transport.open()文件"/Users/user_name/.virtualenvs/entity1/lib/python3.6/site-packages/thrift_sasl/ INIT py"为,线67,在open中如果不是self._trans.isOpen():
这些是我在pip list中安装的软件包
六(1.11.0)thriftpy(0.3.9)thrift-sasl(0.3.0)sasl(0.2.1)impyla(0.14.0)
我正在使用macOS High Sierra作为我的开发环境
给出以下 Python 代码:
# Use impyla package to access Impala
from impala.dbapi import connect
import logging
def process():
conn = connect(host=host, port=port) # Mocking host and port
try:
cursor = conn.cursor()
# Execute query and fetch result
except:
loggin.error("Task failed with some exception")
finally:
cursor.close() # Exception here!
conn.close()
Run Code Online (Sandbox Code Playgroud)
与 Impala 的连接已创建。cursor.close()但由于 Impala 超时,有一个例外。
cursor考虑到潜在的异常,关闭的正确方法是什么conn?
我在windows上使用impyla库时遇到了麻烦
我安装了impyla库
pip install impyla
当我尝试在python代码中导入impyla libary时发生错误
from impala.dbapi import connect # error occured
from impala.util import as_pandas
conn = connect(host='10.xx.xx.xx', database='xx_xx', port=21050)`
Run Code Online (Sandbox Code Playgroud)
追溯(最近的呼叫最后):...
从impala.dbapi import connect输入文件"D:/test/test.py",第14行
文件"C:\ Anaconda3\lib\site-packages\impala\dbapi.py",第28行, 导入impala.hiveserver2为hs2
文件"C:\ Anaconda3\lib\site-packages\impala\hiveserver2.py",第32行, 来自impala._thrift_api import(
文件"C:\ Anaconda3\lib\site-packages\impala_thrift_api.py",第73行,in include_dirs = [thrift_dir])
文件"C:\ Anaconda3\lib\site-packages\thriftpy\parser__init __.py",第30行,加载 include_dir = include_dir)
文件"C:\ Anaconda3\lib\site-packages\thriftpy\parser\parser.py",第496行,在解析url_scheme中))
thriftpy.parser.exc.ThriftParserError:ThriftPy不支持在协议'c'中生成带路径的模块
当我试图打印include_dir时,那是
D:/test\thrift
我根本无法导入libray
帮我