如何使用python运行HIVE和IMPALA shell命令?

时间:2017-05-25 10:44:55

标签: python hive subprocess impala

我必须使用python脚本运行HIVE查询,例如, 为此$ bdscc -e "show databases" 我想在python中做同样的事情,但我收到错误 -

>>> import subprocess
>>> subprocess.call(['bdscc', '-e', 'show databases'])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/subprocess.py", line 524, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

在python中有什么办法吗?

PS-来自终端的命令$ bdscc -e "show databases"正常运行。

UPDATE-- bdscc是我公司为HIVE shell设置的别名

0 个答案:

没有答案