简体   繁体   English

如何在Sqoop中为增量数据指定多列?

[英]How to specify multiple columns for incremental data in Sqoop?

I am using following query to fetch incremental data in sqoop-我正在使用以下查询在 sqoop- 中获取增量数据

bin/sqoop job --create JOB_NAME -- import  --connect jdbc:oracle:thin:/system@HOST:PORT:ORACLE_SERVICE --username USERNAME --password-file /PASSWORD_FILE.txt --fields-terminated-by ',' --enclosed-by '"'  --table SCHEMA.TABLE_NAME --target-dir /TARGET_DIR -m 2 --incremental append --check-column NVL(UPDATE_DATE,INSERT_DATE) --last-value '2019-01-01 00:00:00.000'  --split-by PRIMARY_KEY --direct

It throwing error for Multiple columns in --check-columns parameters.它在 --check-columns 参数中为多列抛出错误。

Is there any approcach to specify multi columns in --check-column parameter?是否有任何方法可以在 --check-column 参数中指定多列?

I want to fetch data , if UPDATE_DATE field contains null value then it should fetch the data on the basis of INSERT_DATE column.我想获取数据,如果 UPDATE_DATE 字段包含空值,那么它应该基于 INSERT_DATE 列获取数据。

I want to extract transaction records from a table which is being updated daily , and if the records is inserted first time then there is no value in UPDATED_DATE column.我想从每天更新的表中提取事务记录,如果记录是第一次插入,那么 UPDATED_DATE 列中没有值。 That's why I need to compare both columns while fetching data from table.这就是为什么我需要在从表中获取数据时比较两列。

Any help regarding this would be highly appreciated.对此的任何帮助将不胜感激。

As per my understanding it doesn't look like it's possible to have 2 check columns when doing incremental imports, so the only way we can manage to get this done is with 2 separate imports:根据我的理解,在进行增量导入时似乎不可能有 2 个检查列,因此我们能够设法完成此操作的唯一方法是使用 2 个单独的导入:

  1. Incremental import with the Insert date as check column for first time records增量导入,插入日期作为第一次记录的检查列
  2. Incremental import with the updated column as check column for UPDATED records使用更新的列作为更新记录的检查列的增量导入

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

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