当前位置:网站首页>Kettle實現共享數據庫連接及插入更新組件實例
Kettle實現共享數據庫連接及插入更新組件實例
2022-07-23 14:55:00 【小龍Hibernation】
常用組件
1、共享數據庫連接
新建的數據庫連接都只屬於某一個轉換程序
如果你想讓所有的轉換程序都能使用這個連接,需要開啟共享

2、錶輸入組件
需求∶將錶中的數據,同步到另一張這張錶中。
分析
- 這是一個轉換任務
- 輸入︰讀取錶的數據
- 轉換 : 沒有轉換過程
- 輸出 : 將結果寫入錶中
實現
開發程序

配置輸入
先配置數據庫連接共享




配置輸出



測試運行


3、插入更新組件
工作需求∶將A錶的數據同步到B錶中,保證B錶的數據與A錶的數據一致,實現是不斷更新的操作
- A錶發生了更新,更新的數據也會同步到B錶中
- A錶沒有發生更新,即使程序運行,B錶也不發生改變
- 數據同步的過程
- 每次只同步更新的數據
- 已經同步過的數據,就不會再進行同步
- 工作中一般一天會同步一次,程序就每天執行一次
解决∶插入更新的輸出組件
功能 : 只會同步發生更新的數據,已經同步過的數據不會再次同步
- 數據更新
- 插入一條新的數據
- 修改一條老的數據
- 數據更新
實現 : 任何時候,兩張錶的數據同步是一致的
開發轉化任務流程圖

定義輸入
與之前步驟一致

定義插入 / 更新


只以id來做比較


測試運行


修改原錶數據或增加,再執行一次,自動進行更新
總結
本文主要兩個知識點:
- 共享數據庫連接
- 插入更新組件
- 同步業務
- 全量︰每次將所有的數據都同步一份
- 保證A和B是一致的
- 每次先删除B所有內容,然後,再同步
- 程序的性能比較差,數據量大了以後,非常慢,不建議使用
- 錶輸出︰全量的組件
- 保證A和B是一致的
- 增量︰每次將發生更新的數據同步,沒有發生更新就是已經同步過的數據不再同步
- 保證A和B是一致的
- 工作中都使用增量的方式
- 插入更新︰增量的組件
- 全量︰每次將所有的數據都同步一份
以上兩個知識點非常貼合和適用於在工作場景中,還可以跟作業搭配,一逸永勞
边栏推荐
- Advanced operation and maintenance 02
- [software test] redis abnormal test encountered in disk-to-disk work
- Due to resource constraints, the namenode fails to start with an error unable to create new native thread
- Solve a series of problems in using Bert encoder
- QT document reading notes audio example analysis
- 直播课堂系统03补充-model类及实体
- linux定时备份数据库脚本
- Linux scheduled database backup script
- The win11 installation system prompts that VirtualBox is incompatible and needs to uninstall the solution of virtual, but the uninstall list cannot find the solution of virtual
- 21 - vertical traversal of binary tree
猜你喜欢
随机推荐
First acquaintance and search set
【 langage c】 devinez jeux numériques + applet d'arrêt
CSDN writing method (II)
21 - 二叉树的垂直遍历
Some libraries that can perform 2D or 3D triangulation
Palindrome related topics
正则表达式常用语法解析
Qt文档阅读笔记-Audio Example解析
身份证号正则验证
(heavy chain dissection) Magic Tree
Common JS modular specification from a code question
It is suggested that Siyuan notes can be compatible with third-party sync disks
The self-developed data products have been iterated for more than a year. Why not buy third-party commercial data platform products?
Leetcode-227-basic calculator||
104 maximum depth of binary tree and 543 diameter of binary tree and 124 maximum path sum of binary tree
直播课堂系统03补充-model类及实体
Detailed tutorial of typora drawing bed configuration
[applet automation minium] i. framework introduction and environment construction
[untitled] test [untitled] test
mysql函数汇总之字符串函数



![[applet automation minium] i. framework introduction and environment construction](/img/1f/95b78e6574c3af3ff7abcf5db838f5.png)

![[array & String & Macro exercise]](/img/44/26debc1ee958277935e73a75d894d4.png)



