搜了一下,看到了StackOverFlow的回答,試了一下前兩個方案,感受第二個更簡潔,這裏記錄一下,更詳細的見參考。python
pip install sasl pip install thrift pip install thrift-sasl pip install PyHive
from pyhive import hive conn = hive.Connection(host='xxxx', port=10000, username='xxx', database='default') cursor.execute('select * from url_log limit 10') for result in cursor.fetchall(): print result