当前位置:网站首页>Kettle实验 转换案例
Kettle实验 转换案例
2022-04-23 09:07:00 【风梳烟】
1.转换案例
最容易实现的简单案例就是生成随机数,并存储到txt文件 新建一个转换保存为test_random(后缀为.ktr) 通过拖拽插件方式,在核心对象->输入和输出分别拖拽“生成随机数”和“文本文件输出”两个按钮, 然后点击“生成随机数”并按下shift键,用鼠标指向“文本文件输出”,以生成剪头,表示数据流向。如下图:



编辑输入流,即“生成随机数”按钮,如图所示

2. 转换案例
然后编辑输出流,即“文本文件输出”按钮,如图所示

查看结果,如图所示
3.正式实验
通过上述简单实验,我们知道了输入输出流的基本操作,接下来我们进入正式实验
1)将上述实验中的输入输出全部改为Excel。进行相关配置说明如下: Excel输入:
在文件选项下,表格类型根据实际进行适配(xls or xlsx),在文件或目录后,点击“浏览”选择自己的源数据文件,然后点击“添加”;
在工作表选项下,点击“获取工作表名称...”添加工作表,即Excel中的sheet1;

在字段选项下,点击“获取来自头部数据的字段...”自动获取字段,由于原Excel中整型数据转入会变成浮点型,所以需要进行更改,如图所示:

1)将上述实验中的输入输出全部改为Excel
进行相关配置说明如下: Excel输出:只需要配置输出文件名即可,其他均为默认。

2)下来需要处理的就行核心步骤,即转换。首先针对生成数据1进行分析,由于kettle中分组需要首先进行排序,从而需要处理的点有:
(1)将挂号日期时间截取到日;
(2)对年龄按照一定标准进行转换(自己定义);
(3)按照待分组的字段进行排序;
(4) 进行分组统计。 按照上述思路,在“转换”和“统计”核心对象中,分别找到对应组件,完成基本数据流节点配置,如图所示:

在“字段选择”组件中,对时间进行处理。 在元数据选项中,需要对Date进行转换成String,格式设置为yyyy-MM-dd,同时可以对字段进行更名操作。 另外还可以对字段进行选择,修改,移除。如图所示:

3)在“数值范围”组件中,对年龄进行处理,划分标准自己定义,如图所示:

4)在“排序记录”组件中,按照生成数据要求,需要对日期,性别,年龄段进行排序,如图所示:
5)在“分组”组件中,进行分组统计,如图所示:

6)执行,结果如图所示:
版权声明
本文为[风梳烟]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_56814370/article/details/123430964
边栏推荐
- Trc20 fund collection solution based on thinkphp5 version
- Illegal character in scheme name at index 0:
- Production practice elk
- valgrind和kcachegrind使用运行分析
- 小程序报错:Cannot read property 'currentTarget' of undefined
- ALV树(LL LR RL RR)插入删除
- Automatic differentiation and higher order derivative in deep learning framework
- Data visualization: use Excel to make radar chart
- Bk3633 specification
- 考研线性代数常见概念、问题总结
猜你喜欢

SAP 101K 411k inventory change

Write down the post order traversal of the ~ binary tree
![[Luke V0] verification environment 2 - Verification Environment components](/img/aa/820000a52bc493a0734ff0eb76f536.png)
[Luke V0] verification environment 2 - Verification Environment components

Introduction to GUI programming swing

ONEFLOW learning notes: from functor to opexprinter

Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
![[C language] document operation](/img/89/b19dda13d27e37fedf6736c102245b.png)
[C language] document operation

Project upload part

Open services in the bottom bar of idea

Failed to download esp32 program, prompting timeout
随机推荐
[C language] document operation
On array replication
2021李宏毅机器学习之Adaptive Learning Rate
LGB, XGB, cat, k-fold cross validation
Node installation
Project upload part
npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
資源打包關系依賴樹
L2-024 tribe (25 points) (and check the collection)
Single chip microcomputer nixie tube stopwatch
Summary of solid problems
Distributed message oriented middleware framework selection - Digital Architecture Design (7)
Talent Plan 学习营初体验:交流+坚持 开源协作课程学习的不二路径
小女孩行走
Flink同时读取mysql与pgsql程序会卡住且没有日志
How to read excel table to database
Get trustedinstaller permission
npm ERR! network
论文阅读《Multi-View Depth Estimation by Fusing Single-View Depth Probability with Multi-View Geometry》
[58] length of the last word [leetcode]