请教一个插表 etl 问题

2019 年 8 月 27 日
 maijh

场景:有一张 union 汇总表(假设表名 m_union ),可能需要多张源表(假设表名 s1,s2,s3...)插进去,请教下大家一般是怎么处理的? 或者有什么开源工具框架推荐? 方法 1: insert into m_union select column1,column2,type from ( select column1,column2,'s1' type from s1 union all select column1,column2,'s2' type from s2 union all select column1,column2,'s3' type from s3 ... .... ..... )a 这种是要等所有源表都入好当天数据才能一次性插到 m_union,优点是一个 etl 任务,但缺点时效性晚,而且初衷是想只要一张源表入好就插进去 m 表里。 方法 2: insert into m_union
select column1,column2,'s1' type from s1; insert into m_union
select column1,column2,'s2' type from s2; insert into m_union
select column1,column2,'s3' type from s3; ... .... ..... 这种可以满足初衷是想只要一张源表入好就插进去 m 表里。但要写很多个 etl 插入任务,而且一个 sql 一个脚本,而且如果是十来二十多张或更多源表就更泪奔了。 方法 3:求大神们的好方法。

1764 次点击
所在节点    Python
1 条回复
maijh
2019 年 8 月 28 日
别沉啊,求教

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://study.congcong.us/t/595580

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX