What is update command in sqoop ?

Answer : There are two approaches to update in sqoop…

Update command in sqoop:

  • There are two approaches to update in sqoop.
    • The records inserted are to be added to the target table.
    • The sqoop provides an update mode by providing “update-key <column(s)>” command.
  • This command is used to generate the SQl update statement.
  • If the value in column 1 matches the data is updated else the data is inserted into the table.
  • This technique is also refered to as upsert where the default action is update but insertion takes place when matching data is not available.
$ sqoop export (Generic Arguments)
  --table target-relational-table 
  --update-key column1
  --export-dir /user/my-hdfs-file
Generates => UPDATE target-relational-table SET
		          WHERE column1=100;
Leave a Reply

Your email address will not be published.

You May Also Like