Python连接Hive

黎东
L、先森
2019-01-18 0 2349

要想使用python连接hive,首先得下载以下几个包

pip3 install sasl
pip3 install thrift
pip3 install thrift-sasl
pip3 install PyHive

下面进行测试,测试代码如下

from pyhive import hive
conn = hive.Connection(host='192.168.104.120', port=10000, username='用户名', database='myhive')
cursor = conn.cursor()
cursor.execute('select * from employee limit 10')
for result in cursor.fetchall():
    print( result)


大数据