我提到了如何在python的sql语句中使用变量?
但却找不到答案。
我在试你的建议,但我得到了这个错误-:(
tbl_nm = 'EMPLOYEE_TABLE'
con.execute('select max(emp_id) from schema.?', tbl_nm)
获取以下错误:
Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/site-packages/impala/hiveserver2.py", line 302,
in execute configuration=configuration) File "/usr/local/lib/python2.7/site-packages/impala/hiveserver2.py", line 343,
in execute_async self._execute_async(op) File "/usr/local/lib/python2.7/site-packages/impala/hiveserver2.py", line 362,
in _execute_async operation_fn() File "/usr/local/lib/python2.7/site-packages/impala/hiveserver2.py", line 334,
in op parameters) File "/usr/local/lib/python2.7/site-packages/impala/interface.py", line 267,
in _bind_parameters
raise ProgrammingError("Query parameters argument should be a "
impala.error.ProgrammingError: Query parameters argument should be a list, tuple, or dict object
>
1条答案
按热度按时间b5lpy0ml1#
建议您将查询作为字符串存储到变量中,并将其传递给execute方法,而不是直接将原始配置单元查询传递给execute方法。
就你而言:
如果这有帮助,请告诉我。