当前位置:网站首页>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是一致的
- 工作中都使用增量的方式
- 插入更新︰增量的組件
- 全量︰每次將所有的數據都同步一份
以上兩個知識點非常貼合和適用於在工作場景中,還可以跟作業搭配,一逸永勞
边栏推荐
- Palindrome related topics
- Yunna | how to manage fixed assets? How to manage fixed assets?
- Wacom firmware update error 123, digital board driver cannot be updated
- Introduction and mechanism of Aptos
- 利用js自动解析执行xss
- About flex layout justify content: the last solution to the misalignment of space around and why it is solved like this is a discussion
- [software testing] how to sort out your testing business
- Which is a good fixed asset management system? What are the fixed asset management platforms?
- OpenHarmony南向学习笔记——Hi3861+HC-SR04超声波检测
- day18
猜你喜欢

【测试平台开发】23. 接口断言功能-保存接口断言和编辑回显

直播课堂系统03补充-model类及实体
![[C language] number guessing game + shutdown applet](/img/2f/643ec964dba7643f91b1bd679a9284.png)
[C language] number guessing game + shutdown applet

如何实现多个传感器与西门子PLC之间485无线通讯?

Leetcode-227-basic calculator||

微信官方出品!小程序自动化框架 minium 分享预告

Using JS to parse and execute XSS automatically

After using vscode to format the code, save and find that the code is messy again. What should I do? Vs remove formatting

Wacom firmware update error 123, digital board driver cannot be updated

工作小记:一次抓包
随机推荐
真人踩过的坑,告诉你避免自动化测试常犯的10个错误
Solve a series of problems in using Bert encoder
【C语言】猜数字小游戏+关机小程序
[WinForm] desktop program implementation scheme for screenshot recognition and calculation
mysql 之general_log日志
452. Detonate the balloon with the minimum number of arrows
Sword finger offer 46. translate numbers into strings
Towhee weekly model
直播课堂系统03-model类及实体
什么是Per-Title编码?
Uni app knowledge points and records of problems and solutions encountered in the project
[software testing] how to sort out your testing business
The accuracy of digital addition
String function of MySQL function summary
[paper notes] mobile robot navigation method based on hierarchical depth reinforcement learning
利用js自动解析执行xss
Sword finger offer19 regular expression
C language implements memcpy and memmove
FastAPI应用加入Nacos
【无标题】