当前位置:   article > 正文

linux 连接hive数据库失败,windows和linux连接hive问题

hive.connect错误,conn = hive.connection(**conn_params)

本文讲述下远程连接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',

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号