python利用pyhive 连接hive

1.下载需求包
  pip install sasl
  pip install thrift
  pip install thrift-sasl
  pip install PyHive

2.连接hive 注意端口默认为10000

from pyhive import hive
conn = hive.Connection(host='192.168.100.100', port=10000, username='root', database='default')
cursor = conn.cursor()
cursor.execute('show tables')

for result in cursor.fetchall():
    print(result)

你可能感兴趣的:(《Python基础知识》,python,hive,大数据)