搜了一下,看到了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