当前位置:网站首页>Kettle实现共享数据库连接及插入更新组件实例
Kettle实现共享数据库连接及插入更新组件实例
2022-07-23 09:34:00 【小龙Hibernation】
常用组件
1、共享数据库连接
新建的数据库连接都只属于某一个转换程序
如果你想让所有的转换程序都能使用这个连接,需要开启共享

2、表输入组件
需求∶将表中的数据,同步到另一张这张表中。
分析
- 这是一个转换任务
- 输入︰读取表的数据
- 转换 : 没有转换过程
- 输出 : 将结果写入表中
实现
开发程序

配置输入
先配置数据库连接共享




配置输出



测试运行


3、插入更新组件
工作需求∶将A表的数据同步到B表中,保证B表的数据与A表的数据一致,实现是不断更新的操作
- A表发生了更新,更新的数据也会同步到B表中
- A表没有发生更新,即使程序运行,B表也不发生改变
- 数据同步的过程
- 每次只同步更新的数据
- 已经同步过的数据,就不会再进行同步
- 工作中一般一天会同步一次,程序就每天执行一次
解决∶插入更新的输出组件
功能 : 只会同步发生更新的数据,已经同步过的数据不会再次同步
- 数据更新
- 插入一条新的数据
- 修改一条老的数据
- 数据更新
实现 : 任何时候,两张表的数据同步是一致的
开发转化任务流程图

定义输入
与之前步骤一致

定义插入 / 更新


只以id来做比较


测试运行


修改原表数据或增加,再执行一次,自动进行更新
总结
本文主要两个知识点:
- 共享数据库连接
- 插入更新组件
- 同步业务
- 全量︰每次将所有的数据都同步一份
- 保证A和B是一致的
- 每次先删除B所有内容,然后,再同步
- 程序的性能比较差,数据量大了以后,非常慢,不建议使用
- 表输出︰全量的组件
- 保证A和B是一致的
- 增量︰每次将发生更新的数据同步,没有发生更新就是已经同步过的数据不再同步
- 保证A和B是一致的
- 工作中都使用增量的方式
- 插入更新︰增量的组件
- 全量︰每次将所有的数据都同步一份
以上两个知识点非常贴合和适用于在工作场景中,还可以跟作业搭配,一逸永劳
边栏推荐
- Work notes: one time bag grabbing
- [C language] number guessing game + shutdown applet
- AI acceleration gesture recognition experience based on efr32mg24
- CSDN writing method (II)
- [untitled]
- [interview frequency] cookies, sessions, tokens? Don't worry about being asked after reading it
- C language project practice: 24 point game calculator (based on knowledge points such as structure, pointer, function, array, loop, etc.)
- Is it risky and safe to open an account for stock speculation?
- 452. 用最少数量的箭引爆气球
- Cmake notes
猜你喜欢
![[untitled]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[untitled]

Typora图床配置详细教程

R语言实战应用案例:绘图篇(三)-多种组合图型绘制

Regular expression common syntax parsing

String function of MySQL function summary

MySQL unique index has no duplicate value, and the error is repeated

PKI体系快速介绍

C thread lock and single multithreading are simple to use

Question 142 of Li Kou: circular linked list 2

Feignclient utilise un tutoriel détaillé (illustration)
随机推荐
Introduction and mechanism of Aptos
Due to resource constraints, the namenode fails to start with an error unable to create new native thread
Wacom firmware update error 123, digital board driver cannot be updated
Using JS to parse and execute XSS automatically
生成订单号
正则表达式常用语法解析
Oracle 报表常用sql
【软件测试】盘一盘工作中遇到的 Redis 异常测试
[array & String & Macro exercise]
【数组&&字符串&&宏练习题】
(heavy chain dissection) Magic Tree
Use of KOA framework
The accuracy of digital addition
Regular expression common syntax parsing
Vk36n5d anti power interference / mobile phone interference 5-key 5-channel touch detection chip anti freeze function ponding in the touch area can still be operated
Question 142 of Li Kou: circular linked list 2
ArgoCD 用户管理、RBAC 控制、脚本登录、App 同步
C language implementation of classroom random roll call system
【无标题】
Game (2) of 2022 Henan Mengxin League: solution to supplementary questions of Henan University of Technology