版权声明:本文为博主原创文章,欢迎转载,转载请注明作者、原文超链接 https://blog.csdn.net/u013220482/article/details/87862590
-
环境
redhat7.2、anaconda4.3、python3.5 -
安装python连接hive的依赖包
- yum install gcc python-devel libsmbclient-devel openldap-devel zlib-devel libjpeg-turbo-devel libtiff-devel freetype-devel libwebp-devel lcms2-devel krb5-devel
- pip install sasl
- pip install thrift
- pip install thrift-sasl
- pip install Pyhive
-
进入python环境,建立连接并查询数据
from pyhive import hive
conn = hive.Connection(host='hosts', port=10000, database='your databases')
import pandas as pd
df = pd.read_sql("SELECT * FROM table limit 10", conn)