環境:mac 、Python3.6.1
安裝impala包
pip install --upgrade pip 更新pip
pip install impyla 注意是y
pip install thrift-sqsl==0.2.1 指定版本,預設安裝的0.3報錯
使用
from impala.dbapi import connect
sql="select * from trade_order limit 10"
conn =connect(host='10.0.0.215', port=10000, user='hadoop', auth_mechanism='PLAIN')
cursor = conn.cursor()
cursor.execute(sql)
results = cursor.fetchall()
columns=[i[0] for i in cursor.description]
df=pd.DataFrame(results,columns=columns)
df.head()