2
votes

I am trying to do a sqoop incremental import (lastmodified) to a hive table . It is working in sqoop 1.4.5 but not in sqoop 1.4.6 .

It is throwing the following error

**Log Upload Time: Mon Nov 13 17:57:58 +0530 2017

        Log Length: 246
      --incremental lastmodified option for hive imports is not supported. Please remove the parameter --incremental lastmodified.

Intercepting System.exit(1) Failing Oozie Launcher, Main class [org.apache.oozie.action.hadoop.SqoopMain], exit code [1]**

3
Thank you very much sqoop committers for breaking our legacy jobs, facing the same issues today. - Havnar

3 Answers

4
votes

Sqoop 1.4.6 doesn't support incremental import to a hive table directly.

However you can import the incremental data without using the --hive-import option and place the incremental data in the HDFS location which is mapped to the hive table using the --target-dir option.

For example

Consider there's a table sqoop_pract with location set to /user/hive/warehouse/sqoop_pract

If you want to perform incremental import for this table you can use a query similar to the following

sqoop import --connect jdbc:mysql://hostname/sample_db --username demo --table sqoop_pract --target-dir /user/hive/warehouse/sqoop_pract --incremental lastmodified --check-column Ts --last-value '2017-11-08 03:51:42' --append -P

In the above command the --target-dir points to the hive table's location, this way you can achieve incremental import to a hive table using sqoop.

0
votes

Sqoop (versions 1.4.6 or below) import is able to run with --hive-import and --incremental lastmodified options but it produces unexpected results. See https://issues.apache.org/jira/browse/SQOOP-2986

0
votes

you can choose hcatalog instead of hive.