使用PyHive操作Hive

使用PyHive操作Hive

废话

搜了一下,看到了StackOverFlow的回答,试了一下前两个方案,感觉第二个更简洁,这里记录一下,更详细的见参考。

安装依赖
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
参考
posted @ 2017-10-23 17:57  wswang  阅读(18857)  评论(0编辑  收藏  举报