sqoop Import New as well as Updated Data - lastmodified mode


Example

If you are adding new rows and updating existing data.

You need two additional parameters:

  • --check-column : A column name that should be checked for newly appended and updated data. date, time, datetime and timestamp are suitable data types for this column.
  • --last-value : The last value that successfully imported into Hadoop. All the newly added and updated data after this value will be imported.
sqoop import \
--connect jdbc:mysql://mysql.example.com/testdb \
--username sqoop \
--password sqoop \
--table employee \
--incremental lastmodified \
--check-column last_update_date \
--last-value "2015-10-20 06:00:01"