- 安装组件
pip install sasl
pip install thrift
pip install thrift-sasl
pip install pyhive
- demo
from pyhive import hive
conn = hive.Connection(host="xxx.xxx.xxx.xxx", port=10000, username="root", database='hivetest')
cursor = conn.cursor()
cursor.execute("select * from employee")
for result in cursor.fetchall():
print(result)