栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

python读取hive 到 pandas

python读取hive 到 pandas

代码
from pyhive import hive
# 脚本目录 用python从hive表中读取表ods_tx3 中列名为 'number' 的列的数据,获取唯一值 即 number的集合.

'''
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
'''

'''
报错: thrift.transport.TTransport.TTransportException: TSocket read 0 bytes
    解决方法:hive-site.xml中添加下面属性 然后重启hive服务:
        
            hive.server2.authentication
            NOSASL
        

检查hiveserver2 的 10000端口是否已经启动: netstat -anp|grep 10000

conda提示无法安装sasl:
    conda update --force conda 然后 conda install sasl 重试
    如果提示c++什么没装,自己安装一下他提供链接的软件即可.懵逼...
'''
conn = hive.Connection(
    host="192.168.9.88"
    , port=10000 # 端口是beeline的端口 所以需要启动beeline服务 hive --service hiveserver2
    , database='default'
    , username="root" # 注意用户名是否在hive h
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/487086.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号