如何根据pentaho水壶中的先前输入数据运行不同的sql以获取数据 [英] How to run different sql to get data according to the previous input data in pentaho kettle

查看:144
本文介绍了如何根据pentaho水壶中的先前输入数据运行不同的sql以获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 10中使用pentaho水壶8.2,db是Oracle,现在我有一个要求并且不知道如何实现此功能. 我的要求是:

I use pentaho kettle 8.2 in Windows 10 and db is Oracle, now i have a requirement and don't know how to realize this function. My requirement is that:

第1步:从db获取数据1;

step 1: get data 1 from db;

步骤2:根据步骤1的数据1的字段从不同的表(sql)获取数据2;

step 2: get data 2 from different table(sql) according to the field of step 1's data 1;

步骤3:根据步骤2中的数据2更新其他数据库.

step 3: update other db according data 2 in step 2.

第1步很容易从一个数据库获取数据,在第2步中,我尝试根据第1步的输出获取数据,我使用Switch/case判断第1步的结果,然后使用不同的SQL script,而模块SQL script没有任何输出,因此我无法运行step3来更新数据.

Step 1 is easy to get data from one db, in step 2, i try to get data based on step 1's output, i use Switch/case to judge step 1's result and then use different SQL script, while module SQL script don't have any output so that i couldn't run step3 to update data.

我担心如何使用水壶实现这种功能.

That's my concern that how can i realize this funcation using kettle.

有人能实现此功能吗?

随附的屏幕截图显示了我当前的transformation: 注意:SQL脚本是select语句,基于此,Update SQL脚本将运行update语句.

Attached screenshot to show my current transformation: Note: SQL script are select statement, based on that, Update SQL script will run update statement.

推荐答案

有两种不同的方法来输入变量,或将输入字段的内容输入到Table Input步骤中.例如,如果在表中保存了SQL语句,则可以在第一个表输入"步骤中读入这些语句,然后将这些语句直接输入到另一个表输入"步骤中.您无需使用为转换设计的所有可能的SQL语句来进行转换案例业务.

There's a couple different ways to input variables, or input the content of an incoming field into a Table Input step. For example, if you have SQL statements saved in a table, you can read those in during your first Table Input step and then feed those statements directly into another Table Input step. You don't need to do that switch case business with all different possible SQL statements engineered into the transformation.

https://wiki.pentaho.com/display/EAI/Table+Input

查看表输入步骤的文档,您将看到很多有关将语句动态输入到表输入中的方法的信息和示例.

Check out the documentation for Table Input step and you'll see there's lots of info and examples on ways to dynamically input statements into Table Input.

这篇关于如何根据pentaho水壶中的先前输入数据运行不同的sql以获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆