使用PyHive操做Hive

使用PyHive操做Hive

废话

搜了一下,看到了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
参考
相关文章
相关标签/搜索