一、安装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(失败)的更多相关文章

  1. Anaconda安装sasl,thrift,thrift-sasl,PyHive连接Hive

    一.安装sasl 安装失败,前往:https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl下载对应自己python版本的sasl 本地安装: 二.安装thrif ...

  2. pyhive 连接 Hive 时错误

    一.User: xx is not allowed to impersonate xxx' 解决办法:修改 core-site.xml 文件,加入下面的内容后重启 hadoop. <proper ...

  3. python3.7 利用pyhive 连接上hive(亲测可用)

    来python爬虫中,经常会遇到数据的存储问题,如果有大量数据,hive存储是个不错的选择. 那么python如何来连接hive呢?网上有各种教程但是都不是很好用,亲自测试pyhive可用 要求:可用 ...

  4. pyhive client连接hive报错处理:Could not start SASL

    本来一切就绪,镜像里已安装如下主要的pip包. pyhive configparser pandas hdfs thrift sqlparse sasl thrift-sasl 但,使用pyhive ...

  5. 通过JDBC连接hive

    hive是大数据技术簇中进行数据仓库应用的基础组件,是其它类似数据仓库应用的对比基准.基础的数据操作我们可以通过脚本方式以hive-client进行处理.若需要开发应用程序,则需要使用hive的jdb ...

  6. java使用JDBC连接hive(使用beeline与hiveserver2)

    首先虚拟机上已经安装好hive. 下面是连接hive需要的操作. 一.配置. 1.查找虚拟机的ip 输入 ifconfig 2.配置文件 (1)配置hadoop目录下的core-site.xml和hd ...

  7. 远程连接RabbitMQ失败

    远程连接RabbitMQ失败 为了避免污染宿主系统环境,于是在虚拟机中搭建了一个linux环境并且按照了rabbitmq-server.然后在远程连接的时候一直连接失败. 官网上面给的例子都是在本地使 ...

  8. 连接SQLServer2005失败--[Microsoft][ODBC SQL Server Driver][DBNETLIB]一般性网络错误。请检查网络文档

    连接SQLServer2005失败,错误信息: 错误类型:Microsoft OLE DB Provider for ODBC Drivers (0x80004005)[Microsoft][ODBC ...

  9. beeline连接hive server遭遇MapRedTask (state=08S01,code=1)错误

    采用beeline连接hive server是遭遇到如下错误: 5: jdbc:hive2://bluejoe0/default> select * from hive_triples wher ...

随机推荐

  1. Eclipse的switch workspace 选项中删除多余的workspace

    方法1 Eclipse图形化工具: 打开Eclipse后,选择功能菜单里的Windows->Preferences->,弹出对话框后,选择General->Startup and S ...

  2. day49—JavaScript阻止浏览器默认行为

    转行学开发,代码100天——2018-05-04 今天主要说明一下通过JavaScript对浏览器默认行为的阻止操作.比如右键菜单的行为. 阻止默认行为的语句为: return false; 例如,阻 ...

  3. EntityFrameworkCore.MySql

    1.点击“工具”->“NuGet包管理器”->“程序包管理器控制台” 分别安装以下几个包 Mysql 版本: Install-Package MySql.Data.EntityFramew ...

  4. 阶段1 语言基础+高级_1-3-Java语言高级_1-常用API_1_第6节 static静态_11_静态static关键字概述

    static静态关键字的基本含义 红色教室都划掉 一份数据分给三个人用,而不是三个人相同的数据,三个对象写三遍没有必要. 只写一遍教室,写在学生的类当中.这样还就可以省内存.如果要换教室的话 ,只需要 ...

  5. python 设置开机启动脚本

    1.创建python_auto.bat的快捷方式,放入启动项: C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Start Menu\ ...

  6. scrapy爬取booking酒店评论数据

    # scrapy爬取酒店评论数据 -- 代码 here:github地址:https://github.com/760730895/scrapy_Booking--  采用scrapy爬取酒店评论数据 ...

  7. Java-Lambda表达式第一篇认识Lambda表达式

    1.Lambda表达式时Java 8新增的特性.Lambda表达式支持将代码块作为方法参数,Lambda表达式允许使用更简洁的代码创建只有一个抽象方法的接口(即函数式接口)的实例. 2.当使用Lamb ...

  8. 厉害了,Apache架构师们遵循的 30 条设计原则

    作者:Srinath 翻译:贺卓凡,来源:公众号ImportSource Srinath通过不懈的努力最终总结出了30条架构原则,他主张架构师的角色应该由开发团队本身去扮演,而不是专门有个架构师团队或 ...

  9. F. Fixing Banners

    http://codeforces.com/gym/102394/problem/F F. Fixing Banners time limit per test 1 second memory lim ...

  10. VBA中如何用environ$ 或 environ方法取得环境变量?

    用索引号取得环境变量Sub EnumSEVars() Dim strVar As String Dim i As Long strVar = Environ$(i) & Then Exit F ...