Impyla不使用配置参数

时间:2016-01-26 20:35:40

标签: python hive impala

我正在尝试使用impyla使用Tez连接到Hive 0.14服务器:

from impala.dbapi import connect
from impala.utils import to_pandas
connection = connect(host='myhost', port=10000, auth_mechanism='PLAIN')
cursor = connection.cursor(configuration={'job.queue.name':'myqueue'})
cursor.execute('show databases') # works ok
cursor.fetchall() # works ok
cursor.execute('select field1, field2 from mydb.mytable where field1 > 2015') # breaks!
df = to_pandas(cursor) # never gets here

错误:

HiveServer2Error: Error while processing statement: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.tez.TezTask

发生了什么事?似乎没有使用configuration

1 个答案:

答案 0 :(得分:0)

Impyla实现了Python database API。查看文档,看起来cursor()方法不接受任何参数。但是,execute() takes a configuration kwarg。尝试:

cursor.execute('select field1, field2 from mydb.mytable where field1 > 2015', configuration={'job.queue.name':'myqueue'})