在python3.6上访问impala数据库
安装impyla包 cmd: python3 -m pip install impyla 在安装的过程中可能会报出Microsoft Visual C++ 14.0 is required 按照提示的链接下载2015版,然后再重新安装就OK代码demo
from impala.dbapi
import connect
from impala.util
import as_pandas
conn = connect(host='
10.161.20.11', port=
21050)
cur = conn.cursor()
cur.execute('
SHOW TABLES')
cur.execute('
SELECT *
FROM businfo')
data = as_pandas(cur)
print (
data)
print (
type(data))
可能遇到的问题 ThriftPy does not support generating module with path in protocol ‘d’ 解决办法:http://blog.csdn.net/dechengtju/article/details/61197641
http://blog.csdn.net/faith_mo_blog/article/details/46985287 https://stackoverflow.com/questions/32338006/write-pandas-table-to-impala