当前位置:网站首页>在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;
边栏推荐
- MySQL limit paging query optimization practice
- "Weilai Cup" 2022 Niuke summer multi school training camp 1
- No.0 training platform course-2. SSRF Foundation
- 【QT】无法在QT创建者中打开包含文件pcap.h(C1083)
- Golang controls the number of goroutines and obtains processing results
- Tableau prep is connected to maxcompute and only writes simple SQL. Why is this error reported?
- 优炫数据库主要线程有哪些?
- Golang encapsulates the packages involved in MySQL and the differences between sqlx and Gorm
- Algorithm -- Fibonacci sequence (kotlin)
- (转帖)eureka、consul、nacos的对比2
猜你喜欢

Digital image processing - Chapter 6 color image processing

jjwt 生成token

美联储SR 11-7:模型风险管理指南(Guidance on Model Risk Management)-万字收藏

泛型 -- 学会它,好处多多

Firefox browser, when accessing Tencent cloud server, failed to establish a secure connection.

Flutter实战-请求封装(一)

MySQL2

指令集 x 数澜科技丨加速政企数字化转型,打造DT领域独角兽企业联盟

Generics -- learn it, and there are many benefits

How to submit C4d animation to cloud rendering farm for fast rendering?
随机推荐
PHP defines the array using commas,
36 - new promise method: allsettled & any & race
Es compares the data difference between the two indexes
零号培训平台课程-2、SSRF基础
? Experiment 7 implementation of PHP management system based on MySQL
Watermelon book learning Chapter 5 --- neural network
jjwt 生成token
MySQL2
Word wrap: break word line feed is compatible with browsers
centos7中关闭oracle服务自动启动的功能
[Vani has a date] tail on rainy days
李沐动手学深度学习V2-transformer和代码实现
How to learn C language? This article gives you the complete answer
Gbase 8C - SQL reference 6 SQL syntax (11)
Digital image processing -- Chapter 3 gray scale transformation and spatial filtering
泛型 -- 学会它,好处多多
【golang学习笔记2.1】 golang中的数组中的排序和查找
Pytorch model
MySQL quickly compares database table data
C# Winfrom 常用功能整合-2