美文网首页大数据
用python访问Hive中的数据

用python访问Hive中的数据

作者: cosine90 | 来源:发表于2018-04-19 20:03 被阅读0次

今天尝试用python访问Hive中的数据,以下是一些总结:

环境: Ubuntu 16.04 LTS

Python版本:python3.6(anaconda3里面的)

需要额外按照的Linux库

依赖的包和版本:sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev

impyla                    0.13.8                    

thrift                    0.9.3                     

thrift-sasl               0.2.0                     

thriftpy                  0.3.8                     

sasl                      0.2.1             

这个版本号的组合能够运行。实例如下:

LDAP认证方式在这里面的参数是PLAIN

from impala.dbapi import connect

conn = connect(host='****',database='default',port=10000,auth_mechanism='PLAIN'

               ,user='  ',password='')      

剩下的和python访问mysql一样

相关文章

网友评论

    本文标题:用python访问Hive中的数据

    本文链接:https://www.haomeiwen.com/subject/wergkftx.html