当前位置:网站首页>在kettle使用循环来处理表中的数据
在kettle使用循环来处理表中的数据
2022-07-27 06:10:00 【hawanglc】
有时候,如果kettle事务中源表的数据非常大的时候,一下子把源表中的数据全部读入内存的方式是不可取的。在mysql中,我们可以通过循环的方式,使用limit来定量取得一部分数据来处理。即,关键的sql是:select * from table_name limit current_value, step_value; 以下做一个思路演示。
1:取得记录中的所有的数量,初始化当前循环值等;
2:循环的判断条件是:当前的循环值小于最大的循环值
2.1:修改sql语句中查询的起始值
2.2:用一个转换来处理查询结果,这个例子是将结果追加到文件中;
2.3:将当前的循环值加1;
总的job流程图

第1步的配置信息

第2步的配置信息

第2.1步的配置信息
var stepValue = new Number(parent_job.getVariable("STEP_VALUE"));
var i = new Number(parent_job.getVariable("CURRENT_LOOP"))*stepValue;
parent_job.setVariable("CURRENT_CURSOR",i);
true;
第2.2步的配置信息

第2.3步的配置信息
var i = new Number(parent_job.getVariable("CURRENT_LOOP"))+1;
parent_job.setVariable("CURRENT_LOOP",i);
true;
边栏推荐
- Jmeter: interface automation test - BeanShell compares database data and return data
- 使用pip命令切换不同的镜像源
- Drools(5):Drools高级语法
- Pytorch notes: td3
- Codeforces Round #804 (Div. 2)(5/5)
- The possibility of metauniverse from the perspective of technical principles: how Omniverse "built" Mars
- How to implement Devops with automation tools | including low code and Devops application practice
- oracle的触发器的使用举例
- (posted) comparison of Eureka, consumer and Nacos 2
- 12. Integer to Roman
猜你喜欢

Drools(5):Drools基础语法(3)

Gbase 8C product introduction

Instruction set x digital technology accelerates the digital transformation of government and enterprises, and builds Unicorn enterprise alliance in DT field

Which C4d cloud rendering platform to cooperate with?

软件测试十大必问面试题(附答案和解析)

Relevant principles of MySQL index optimization

(转帖)eureka、consul、nacos的对比1

Usage of string class

35. Search Insert Position 搜索插入位置

jjwt 生成token
随机推荐
内部类--看这篇就懂啦~
(posted) comparison of Eureka, consumer and Nacos 2
请问有人使用oracle xstream 时出现个别capture延迟很大的吗,该如何解决延迟问题呢
MySQL: 提高最大连接数
Which C4d cloud rendering platform to cooperate with?
Confluence漏洞学习——CVE-2021-26084/85,CVE-2022-26134漏洞复现
高级IO提纲
泛型 -- 学会它,好处多多
优炫数据库主要线程有哪些?
LogCat工具
VIM editor deletes all file contents
使用sqlplus显示中文为乱码的解决办法
Analysis on the current situation and optimization strategy of customer experience management in banking industry
Watermelon book learning Chapter 5 --- neural network
一款开源 OA 办公自动化系统
Golang controls the number of goroutines and obtains processing results
Consideration on how the covariance of Kalman filter affects the tracking effect of deepsort
2022 0726 顾宇佳 学习笔记
py2exe qt界面风格变成了win98解决方案
Automatically generate UML sequence diagram according to text (draw.io format)