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.
[pastacode lang=”markdown” manual=”%24%20sqoop%20export%20(Generic%20Arguments)%0A%20%20–table%20target-relational-table%20%0A%20%20–update-key%20column1%0A%20%20–export-dir%20%2Fuser%2Fmy-hdfs-file%0A%20%20…%0AGenerates%20%3D%3E%20UPDATE%20target-relational-table%20SET%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20column2%3D1000%2Ccolumn3%3D2000%0A%09%09%20%20%20%20%20%20%20%20%20%20WHERE%20column1%3D100%3B” message=”” highlight=”” provider=”manual”/]
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like