[英]Create Sqoop Hive Import Job
I successfully did an ad hoc import from an oracle table into Hive table using Sqoop. 我成功地使用Sqoop从oracle表临时导入了Hive表。 Now I want to create and save a Sqoop job with the exact parameters I used for the ad hoc import.
现在,我想使用我用于即席导入的确切参数来创建并保存Sqoop作业。
But if I say: 但是如果我说:
sqoop job --create myjob --import \\ --connect jdbc:mysql://host.port/foo \\ --username myUserName \\ --password-file file:///myfile.pwd \\ --table mytable \\ --create-hive-table \\ --hive-import \\ --hive-database my_hive_db \\ --hive-table my_hive_table \\ --fields-terminated-by '|' \\ --hive-drop-import-delims \\ --m 1
I get an ERROR: 我收到一个错误:
19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Error parsing arguments for job: 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: --import 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: jdbc:mysql:@host:port/foo
If I delete all the \\ it still doesn't work. 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Error parsing arguments for job: 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: --import 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: --connect 19/03/05 14:56:41 ERROR tool.BaseSqoopTool: Unrecognized argument: jdbc:mysql:@host:port/foo
如果我删除所有\\,它仍然不会不行
How do I define a Sqoop job with all the necessary parameters for Hive import? 如何定义带有Hive导入所有必需参数的Sqoop作业?
Seems to be a bash escape issue. 似乎是bash逃逸问题。 There should be no space just after the backslack "\\" characters at the end of the line.
该行末尾的反斜杠“ \\”字符后不应有空格。 You can see the extra spaces with:
您可以通过以下方式看到额外的空格:
cat -A sqoop_script.sh
Not sure if the example you provide is wrong, but I was always using a slightly different syntax where import was not a flag inside a job. 不知道您提供的示例是否错误,但是我始终使用稍微不同的语法,其中import并不是作业中的标志。
From the documentation , these 2 syntaxes seem familiar to me: 从文档中 ,这两种语法对我来说似乎很熟悉:
sqoop import (generic-args) (import-args)
sqoop-import (generic-args) (import-args)
You are missing space
between --
and import
. 您在
--
和import
之间缺少space
。
Try with below syntax: 尝试使用以下语法:
sqoop job --create myjob -- import \
--connect jdbc:mysql://host.port/foo \
--username myUserName \
--password-file file:///myfile.pwd \
--table mytable \
--create-hive-table \
--hive-import \
--hive-database my_hive_db \
--hive-table my_hive_table \
--fields-terminated-by '|' \
--hive-drop-import-delims \
--m 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.