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 ...
随机推荐
- Ajax的封装。
封装 Ajax 因为Ajax 使用起来比较麻烦,主要就是参数问题,比如到底使用GET 还是POST:到 底是使用同步还是异步等等,我们需要封装一个Ajax 函数,来方便我们调用. 封装支持接收来 ...
- 用Vue来实现音乐播放器(六):JSONP的封装
在npm上下载jsonp的包 这个包的用法 传入的参数是地址加上地址参数的混合 但是想封装一个将地址和地址参数分别传入的jsonp方法 所以来封装一个 import originJSONP from ...
- 用JS实现将十进制转化为二进制
- vue-element-template模板项目使用记录(持续更新)
1. npm 使用注意事项: a. node.js 使用 v8.16.0 版本,使用 v10 版本会有各种莫名其妙的报错 b. 开箱先改淘宝镜像: npm config set registry ht ...
- python学习笔记(数据类型)
python数据类型: int 类型 float 小数类型 string 字符串 布尔类型 a = True b = False 1.列表,也称数组或list或array.它的表达方式通过下标或索引或 ...
- 07 归档模式 Active redo log丢失或损坏的恢复
环境同上一篇 模拟处于active状态的redo log损坏 sesion 1 SYS@ orcl >/ GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEM ...
- django-xadmin设置全局变量
class GlobalSetting(object): site_title = '自己的命名' site_footer = '底部命名'# 收缩菜单 menu_style = 'accordion ...
- python 正则表达式 re.split
内置函数split与re库中的split,有很多相似处 #!use/bin/python #coding:utf-8 import re str= "https://i.cnb1logs.c ...
- SpringMVC起步(一)
SpringMVC起步(一) 笔记来源于慕课网:https://www.imooc.com/video/7126/0 MVC:Model-View-Controller Model:模型层,业务数据的 ...
- MySQL-第十二篇管理结果集
1.ResultSet 2.可更新的结果集,使用ResultSet的updateRow()方法.