下面是我在oozie中的sqoop命令。
<action name="sqoop_test" retry-max="${maxretry}" retry-interval="${retryinterval}">
<sqoop xmlns="uri:oozie:sqoop-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<command>import --connect jdbc:mysql:loadbalance://sql01.sboxdc.com/mydb --username usr1 --password********--table source_table --incremental lastmodified -check-column last_modified --merge-key Id --last-value "${wf:actionData('get_last_modified_time')['last_modified_date']}" --target-dir /warehouse/external_data/sms/target_location --as-textfile </command>
</sqoop>
<ok to="end"/>
<error to="fail"/>
</action>
上述操作失败,因为它将最后一个值打断为新行。
从日志:
Sqoop command arguments :
import
--connect
jdbc:mysql:loadbalance://sql01.sboxdc.com/mydb
--username
usr1
--password
********
--table
source_table
--incremental
lastmodified
-check-column
last_modified
--merge-key
Id
--last-value
"2019-01-01
00:00:00"
--target-dir
/warehouse/external_data/sms/target_location
--as-textfile
2019-06-18 11:19:25,768 ERROR [main] org.apache.sqoop.tool.BaseSqoopTool: Error parsing arguments for import:
2019-06-18 11:19:25,768 ERROR [main] org.apache.sqoop.tool.BaseSqoopTool: Unrecognized argument: 00:00:00"
2019-06-18 11:19:25,768 ERROR [main] org.apache.sqoop.tool.BaseSqoopTool: Unrecognized argument: --target-dir
2019-06-18 11:19:25,768 ERROR [main] org.apache.sqoop.tool.BaseSqoopTool: Unrecognized argument: /warehouse/external_data/sms/sb_subscribermacs
2019-06-18 11:19:25,768 ERROR [main] org.apache.sqoop.tool.BaseSqoopTool: Unrecognized argument: --as-textfile
如何强制sqoop在单行中匹配'last\u value'值?
1条答案
按热度按时间31moq8wy1#
正如您所发现的,当您使用command元素时,oozie会将每个空格上的命令拆分为多个参数。如果参数中有空格,比如最后一个值的日期,则应该使用多个空格
arg
而不是选项。所以会是这样的: