简体   繁体   English

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

[英]Running sqoop using python subprocess can't recognize the arguments

When I run sqoop export from terminal it runs properly.But executing it from python scripts returns error: 当我从终端运行sqoop export时 ,它可以正常运行。但是从python脚本执行它会返回错误:

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

Following is the code snippet: 以下是代码段:

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

Assuming imported the subprocess module 假设导入了子流程模块

The single arguments in your argument list shouldn't contain any whitespaces. 参数列表中的单个参数不应包含任何空格。 The line should look like this: 该行应如下所示:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM