sqoop
全量导入分区表
sqoop import \
--connect jdbc:mysql://192.168.50.159:3306/test \
--username root \
--password 123456 \
--table t_user \
--fields-terminated-by '\t' \
--hive-database test \
--hive-table test_t_user \
--hive-import \
--hive-partition-key day \
--hive-partition-value "2022-08-08"
增量导入分区表
sqoop import \
--connect jdbc:mysql://192.168.50.159:3306/test \
--username root \
--password 123456 \
--table t_user \
--where "(update_time>='2022-08-09 00:00:00')" \
--fields-terminated-by '\t' \
--hive-database test \
--hive-table inc_test_t_user \
--hive-import
hive
合并增量生成新分区
insert overwrite table test_t_user partition(day='2022-08-09')
select coalesce(a.s_id,i.s_id) as s_id,
coalesce(i.s_name,a.s_name) as player_name,
coalesce(i.s_class_id,a.s_class_id) as s_class_id,
coalesce(i.update_time,a.update_time) as update_time
from test_t_user a full outer join inc_test_t_user i on a.s_id=i.s_id;
删除分区
alter table test drop partition (day<='2022-07');