pyhive连接hive(失败)
一、安装pyhive
pip install sasl(需要来下载至本地安装:https://download.lfd.uci.edu/pythonlibs/q4hpdf1k/sasl-0.2.1-cp37-cp37m-win_amd64.whl)
pip install thrift
pip install thrift-sasl
pip install PyHive
二、编码
#!/usr/bin/env python
# -*- coding: utf-8 -*- from pyhive import hive class PyHive(object): def __init__(self):
self.host = 'node06.research.com'
self.port = 10000
self.username = 'root'
self.database = 'default'
self.conn_hive() def conn_hive(self):
conn = hive.Connection(host=self.host, port=self.port, username=self.username, database=self.database)
return conn.cursor() def inst_hive(self):
pass def select_hive(self, table):
return self.conn_hive().execute("select * from " + table + " limit 10") def close_conn(self):
return self.conn_hive().close() if __name__ == "__main__":
test_hie = PyHive()
try:
result = test_hie.select_hive('default.kylin_sales')
for res in result:
print(res) except ConnectionError as e:
print(e)
finally:
test_hie.close_conn()
三、异常
Traceback (most recent call last):
File "D:/WorkSpace/Python/PyHive/conn_hive.py", line , in <module>
test_hie = PyHive()
File "D:/WorkSpace/Python/PyHive/conn_hive.py", line , in __init__
self.conn_hive()
File "D:/WorkSpace/Python/PyHive/conn_hive.py", line , in conn_hive
conn = hive.Connection(host=self.host, port=self.port, username=self.username, database=self.database)
File "C:\Anaconda3\lib\site-packages\pyhive\hive.py", line , in __init__
self._transport.open()
File "C:\Anaconda3\lib\site-packages\thrift_sasl\__init__.py", line , in open
message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2' Process finished with exit code
最终没有找到解决方法。
https://ask.hellobi.com/blog/ysfyb/18251
pyhive连接hive(失败)的更多相关文章
- Anaconda安装sasl,thrift,thrift-sasl,PyHive连接Hive
一.安装sasl 安装失败,前往:https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl下载对应自己python版本的sasl 本地安装: 二.安装thrif ...
- pyhive 连接 Hive 时错误
一.User: xx is not allowed to impersonate xxx' 解决办法:修改 core-site.xml 文件,加入下面的内容后重启 hadoop. <proper ...
- python3.7 利用pyhive 连接上hive(亲测可用)
来python爬虫中,经常会遇到数据的存储问题,如果有大量数据,hive存储是个不错的选择. 那么python如何来连接hive呢?网上有各种教程但是都不是很好用,亲自测试pyhive可用 要求:可用 ...
- pyhive client连接hive报错处理:Could not start SASL
本来一切就绪,镜像里已安装如下主要的pip包. pyhive configparser pandas hdfs thrift sqlparse sasl thrift-sasl 但,使用pyhive ...
- 通过JDBC连接hive
hive是大数据技术簇中进行数据仓库应用的基础组件,是其它类似数据仓库应用的对比基准.基础的数据操作我们可以通过脚本方式以hive-client进行处理.若需要开发应用程序,则需要使用hive的jdb ...
- java使用JDBC连接hive(使用beeline与hiveserver2)
首先虚拟机上已经安装好hive. 下面是连接hive需要的操作. 一.配置. 1.查找虚拟机的ip 输入 ifconfig 2.配置文件 (1)配置hadoop目录下的core-site.xml和hd ...
- 远程连接RabbitMQ失败
远程连接RabbitMQ失败 为了避免污染宿主系统环境,于是在虚拟机中搭建了一个linux环境并且按照了rabbitmq-server.然后在远程连接的时候一直连接失败. 官网上面给的例子都是在本地使 ...
- 连接SQLServer2005失败--[Microsoft][ODBC SQL Server Driver][DBNETLIB]一般性网络错误。请检查网络文档
连接SQLServer2005失败,错误信息: 错误类型:Microsoft OLE DB Provider for ODBC Drivers (0x80004005)[Microsoft][ODBC ...
- beeline连接hive server遭遇MapRedTask (state=08S01,code=1)错误
采用beeline连接hive server是遭遇到如下错误: 5: jdbc:hive2://bluejoe0/default> select * from hive_triples wher ...
随机推荐
- ASP.NET Core 上传微信永久视频素材
话不多说直接上源码 请求实体 public class AddVideoRequest { /// <summary> /// 文件流 / ...
- java对接短信平台
短信验证码目前是比较主流验证身份的一种方式,下面分享下我对接的几种短信平台 阿里云短信:https://api.alidayu.com/docs/api.htm?spm=a3142.7395905.4 ...
- Oracle编程艺术--配置环境
如何设置login.sql,参照了本书作者的意见,我也大概弄明白了 只是该文件的存放位置一直就出错,百度了很久,说是$ORACLE_HOME/sqlplus/admin/glogin.sql(默认)于 ...
- python函数及调用
python的函数是一段重复多次可调用的代码,依据python的函数,我们可以利用函数式的编程,来减少代码的重复. 在本章节中,详细的介绍python的函数,以及python的函数式编程的与众不同,函 ...
- 快速排序 && 寻找第K大(小)的数
参考:https://minenet.me/2016/08/24/quickSort.html 快速排序 利用分治法可将快速排序的分为三步: 在数据集之中,选择一个元素作为"基准" ...
- [19/05/18-星期六] HTML_form标签
一.form标签(一) <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> & ...
- SpringBoot(四) -- SpringBoot与Web开发
一.发开前准备 1.创建一个SpringBoot应用,引入我们需要的模块 2.SpringBoot已经默认将这些场景配置好了,只需要在配置文件中指定少量配置,就能运行起来 3.编写业务代码 二.静态资 ...
- Python:库文件
可以引用的Python文件:自己写的.py + 外部库(external libraries)
- 初识STM8S105K心得!
最近由于公司项目需要STM8S105K这颗芯片,这两天我也捣鼓了下,正好现在开通了博客,以此记录下自己的工作. 开发环境: window10操作系统: IAR for ...
- [BZOJ4358]Permu(回滚莫队)
[BZOJ4358]Permu(回滚莫队) 题面 给出一个长度为n的排列P(P1,P2,...Pn),以及m个询问.每次询问某个区间[l,r]中,最长的值域连续段长度. 分析 最简单的方法显然是用线段 ...