我已经安装了impyla和它的依赖关系遵循这指南。安装似乎是成功的,因为现在我可以在Anaconda文件夹中看到文件夹"impyla-0.13.8-py2.7.egg" (64位Anaconda 4.1.1版本)。
但是,当我在python中导入impyla时,会得到以下错误:
>>> import impyla
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named impyla我已经安装了64位Python2.7.12
有谁能解释一下我为什么要面对这个错误?,我在上是新手,在不同的博客上花了很多时间,但是我还没有看到太多的信息。提前谢谢你的时间。
发布于 2016-08-31 12:51:11
用法与您所提到的略有不同(来自https://github.com/cloudera/impyla)
Impyla实现PythonDBAPIv2.0 (PEP 249)数据库接口(有关API详细信息,请参阅它):
from impala.dbapi import connect
conn = connect(host='my.host.com', port=21050)
cursor = conn.cursor()
cursor.execute('SELECT * FROM mytable LIMIT 100')
print cursor.description # prints the result set's schema
results = cursor.fetchall()游标对象还公开迭代器接口,该接口被缓冲(由cursor.arraysize控制):
cursor.execute('SELECT * FROM mytable LIMIT 100')
for row in cursor:
process(row)你也可以拿回一个熊猫DataFrame对象
from impala.util import as_pandas
df = as_pandas(cur)
# carry df through scikit-learn, for examplehttps://stackoverflow.com/questions/39249170
复制相似问题