使用python子进程运行sqoop无法识别参数

时间:2015-08-03 07:00:54

标签: python subprocess sqoop

当我从终端运行 sqoop export 时,它正常运行。但是从python脚本执行它会返回错误:

*ERROR tool.BaseSqoopTool: Unrecognized argument: --connect
ERROR tool.BaseSqoopTool: Unrecognized argument: --table
ERROR tool.BaseSqoopTool: Unrecognized argument: --export_dir*

以下是代码段:

call(["/usr/local/sqoop/bin/sqoop","export","--connect jdbc:mysql://localhost/temp","--table table1" ,"--export-dir /user/data/input" ,"--username root"])

假设导入了子进程模块

1 个答案:

答案 0 :(得分:1)

参数列表中的单个参数不应包含任何空格。该行应如下所示:

call(["/usr/local/sqoop/bin/sqoop","export","--connect", "jdbc:mysql://localhost/temp","--table", "table1" ,"--export-dir", "/user/data/input" ,"--username", "root"])