1.下载需求包
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
2.连接hive 注意端口默认为10000
from pyhive import hive
conn = hive.Connection(host='192.168.100.100', port=10000, username='root', database='default')
cursor = conn.cursor()
cursor.execute('show tables')
for result in cursor.fetchall():
print(result)
本文详细介绍了如何通过pip安装必要的库如sasl、thrift和PyHive,并演示了如何使用Python的PyHive库连接Hive数据库,包括设置连接参数和执行基本查询。

4097

被折叠的 条评论
为什么被折叠?



