安装依赖
pip install sasl
pip install thrift
pip install thrift-sasl
pip install PyHive
python脚本示例
from pyhive import hive
HOST="127.0.0.1"
PORT=10000
USERNAME="hadoop"
DATABASE="default"
conn=hive.Connection(host=HOST, port=PORT, username=USERNAME,database=DATABASE)
cursor = conn.cursor()
#cursor.execute("INSERT INTO TABLE test_out(name,count,time) SELECT name,count(1),to_date(time) FROM test GROUP BY name,to_date(time)")
cursor.execute("SELECT * FROM test")
for result in cursor.fetchall():
print(result[2])
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。