一、安装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. ASP 数据库分页

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% Response.buffer=false %> ...

  2. jsonify返回中文乱码的问题

    参考博客: 解决flask中文乱码的问题 返回内容如图: 实际填写的内容: 从网上找答案,结果很多都是说配置app.config,如下: app.config['JSON_AS_ASCII'] 但我试 ...

  3. All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters

    ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control character ...

  4. python2.7+appium环境搭建

    实现android自动化 目录 1.环境准备.安装包准备 2.安装 3.验证环境搭建成功 1.环境准备.安装包准备 第一步:环境准备: java环境 python环境 第二步:准备安装包 Node.j ...

  5. 类InetAddress

    如果一个类没有构造方法:A:成员全部是静态的(Math,Arrays,Collections)B:单例设计模式(Runtime)C:类中有静态方法返回该类的对象(InetAddress) public ...

  6. MVC 源码系列之路由(一)

    路由系统 注释:这部分的源码是通过Refector查看UrlRoutingModule的源码编写,这部分的代码没有写到MVC中,却是MVC的入口. 简单的说一下激活路由之前的一些操作.一开始是由MVC ...

  7. 自翻唱龙珠超OP2【限界突破X幸存者】

    娱乐向:自翻唱龙珠超OP2[限界突破X幸存者] 翻唱度盘下载>> MP4: http://video.yingtu.co/0/e20dad3b-14d1-47a4-ad26-196a961 ...

  8. 浅谈Java反射机制 之 使用类的 属性、方法和构造函数

    前面两篇我们总结了Java反射机制如何获取类的字节码,如何获取构造函数,属性和方法, 这篇我们将进一步验证如何使用我们获取到的属性.方法以及构造函数 1.使用 反射 获取到的 属性 import ja ...

  9. 安全运维 - Linux系统攻击回溯

    入侵排查思路 (1)- 日志分析 日志分析 默认日志路径: /var/log 查看日志配置情况: more /etc/rsyslog.conf 重要日志: 登录失败记录: /var/log/btmp ...

  10. 版本控制工具 GIT 简要教程

    一,Git 简介 其实这个就不用说了 但是国际惯例还是介绍一下吧; Git 是一个开源的分布式版本控制系统,用于敏捷 高效地处理任何或小或大的项目. Git 是 Linus Torvalds 为了帮助 ...