How to overwrite MySQL table when using sqoop export from Hive

I need to transfer data from Hive to MySQL.

Here is my sqoop command:

jdbc:mysql://mysqlserver --username username --password password --table test --columns "member_id,answer_id,answerer_id" -m 1 --export-dir /user/hive/warehouse/utils.db/test --input-fields-terminated-by \001 --lines-terminated-by \n --update-mode allowinsert 

But every time I run this command, the data seems to be added to the table, but do not overwrite the table.

So, is there a way that I can automatically trim the MySQL table when running this sqoop command?

+4
source share
1 answer

, , , . , . . - --staging-table --clear-staging-table, . - , . , . sqoop . "test" "dummy" .

jdbc:mysql://mysqlserver --username username --password password --table dummy --columns "member_id,answer_id,answerer_id" -m 1 --export-dir /user/hive/warehouse/utils.db/test --input-fields-terminated-by \001 --lines-terminated-by \n --update-mode allowinsert --staging-table test --clear-staging-table
+3

Source: https://habr.com/ru/post/1657398/


All Articles