1.文档编写目的
在前面Fayson介绍了在Python2的环境下《如何使用Python Impyla客户端连接Hive和Impala》,本篇文章Fayson主要介绍在Python3的环境下使用Impyla访问非Kerberos环境下的Hive以及将获取到的结果集转换为Pandas的DataFrame。
内容概述
1.前置环境准备及说明
2.Python3示例代码及运行
3.总结
测试环境
1.CM5.14.3和CDH5.14.2
2.Redhat7.4
3.Python 3.6.5
4.集群未启用Kerberos
2.前置环境准备及说明
在使用Impyla访问Hive前,需要安装Python的依赖包,具体需要安装的依赖包列表如下:
six
bit_array
impyla
thrift
thrift_sasl==0.2.0
1.Python3的安装目录/opt/cloudera/anaconda3
2.升级Python的pip版本
[root@cdh02 ~]# /opt/cloudera/anaconda3/bin/pip install --upgrade pip
(可左右滑动)
3.使用Python3的pip安装上述的依赖包
/opt/cloudera/anaconda3/bin/pip install six
/opt/cloudera/anaconda3/bin/pip install bit_arra