开发机环境准备
Hive库
sudo apt-get install libsasl2-dev
sudo pip install pyhive[hive]
Redis库
pip install redis
线下Redis环境的部署(用于测试)
sudo apt-get install redis-server
cd /usr/bin/
./redis-server
Hive数据查询->本地json文件
from pyhive import hive
port = 111
sql = """
select * from dm_video.ml_media_stats_daily
where date = "20180820" and stats_type = "all"
LIMIT 1000
"""
if __name__ == '__main__':
print "hello"
conn = hive.Connection(host='ip地址', port=port, username='chengxianglong', database='dm_video')
cursor = conn.cursor()
cursor.execute(sql)
for<