(一) Kettle
1、查询中间表 table_d 中的最大时间 t_d_max
2、查询原始表 table_o 中的最大时间 t_o_max
3、数据同步
insert into table_d
selet xxx
from table_o
where t_o_max > 时间字段 > t_d_max – 大于和小于,两个比较都不要加等号
(二) DataWorks
场景和需求:
1、GPS实时数据,需要每小时同步一次;
2、数据有 3 分钟的延迟;
同步方案:
1、调度设置:调度周期为小时
2、开始时间 0:30,时间间隔 1 小时,结束时间 23:59
DataWorks 任务参数设置:
# 分区
dt = ${bdp.system.cyctime}
# 根据业务时间数据分片
gpstime>='${t1}' and gpstime<='${t2}'
# 参数设置
-p"t1='$[yyyy-mm-dd-1/24] $[hh24-1/24]:00:00' t2='$[yyyy-mm-dd-1/24] $[hh24-1/24]:59:59'"