赞
踩
本文讲述下远程连接Hive遇到的一些问题
一、CentOS连接Hive
尝试使用CentOS 7远程连接Hive,首先安装好需要的相关包pip install pyhive
pip install thrift
yum install cyrus-sasl-devel.x86_64
pip install sasl
pip install thrift-sasl==0.2.1
1.连接Hive$python
>>> from pyhive import hive
>>> conn = hive.Connection(host='192.168.12.5', port=10000, username='root', database='behavior_labels')
>>> cur=conn.cursor()
>>> cur.execute('SHOW TABLES')
>>> cur.fetchall()
另外:当使用create_engine连接hive时需要安装pyhive,如果报错ImportError: cannot import name TFrozenDict时,升级thrift版本。
目前pandas使用to_sql存入数据到hive只能存入一行就失败。from sqlalchemy import create_engine
engine = create_engine('hive://root@192.168.12.67:10000/item_recommand')
data.to_sql('user',
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。