使用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
參考


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM