从mysql增量导出到hive库
增量导入参数:--check-column Source column to check for incremental
--incremental Define an incremental import of type
--last-value Last imported value in the incremental
--columns 指定源表字段
--enclosed-by 行业分隔符
目前可以使用两种方式:
-
append模式
可以使用append 加 --where 来达到根据时间戳来增量更新。
sqoop import --connect jdbc:mysql://192.168.100.36:3306/test -username admin -password admin --table test_mysql_to_hive_mic --where "jap_date_time >20160101.100101 and jap_date_time <=20161127.100101" --hive-database mysql --hive-table test_mysql_to_hive --split-by des_mysql_id --hive-import --incremental append --check-column des_mysql_id --last-value 0 --enclosed-by "\t"
-
lastmodified模式
直接使用lastmodified来根据时间戳增量更新。
<

本文介绍了如何使用 Sqoop 将 MySQL 数据增量导入到 Hive 库,重点讲解了 append 和 lastmodified 两种模式。在 append 模式中,利用 --where 子句根据时间戳进行增量更新;而在 lastmodified 模式下,直接基于时间戳进行增量更新。文中还提到了执行 Java 调用时的注意事项和解决行业分隔符问题的方法。
最低0.47元/天 解锁文章
628

被折叠的 条评论
为什么被折叠?



