talend - 参数化 tOracleInput 查询和输出命名 [英] talend - parameterized tOracleInput query and naming of output

查看:24
本文介绍了talend - 参数化 tOracleInput 查询和输出命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视图作为 tOracleInput 和另一个用于输出的组件(为了简单起见,让 day tOutputDelimited).

  1. 现在我想在我的 tOracleInput 中的一些字段中添加一个 where 子句来过滤数据.这个想法是在 jar 执行期间将这些值作为参数传递以过滤输出.

  2. 此外,输出的文件名必须来自 jar 执行传递的第一个参数.

任何人都可以启发我如何实现 1 &2.

提前致谢

解决方案

在你的工作中,创建 2 context variables 输入字符串,比如 out_filenamewhere_value.

tOracleInput 组件中,在查询框中,您可以像这样连接 where 值:

"select * from my_view where field" + context.where_value

tOutputDelimited 组件中,在文件名框中,您可以像这样使用上下文变量:

"/home/user/" + context.out_filename

现在你可以像这样在行命令中传递它们:

my_job_launcher.sh --context_param out_filename='output.txt' --context_param where_value='>7'

I have a view as a tOracleInput and another component for output (lets day tOutputDelimited for simplicity purpose).

  1. Now I want to add a where clause to some of the fields in my tOracleInput to filter data. The idea is to pass these value as an argument during the jar execution for filtering of output.

  2. Moreover, the filename of the output must came from the first argument passed from jar execution.

Anyone can enlighten me on how to achieve 1 & 2.

Thanks in advance

解决方案

In your job, create 2 context variables typed string, let say out_filename and where_value.

In the tOracleInput component, in the query box, you can concatenate the where value like this :

"select * from my_view where field" + context.where_value

In tOutputDelimited component, in the file name box, you can use the context variable like this :

"/home/user/" + context.out_filename

Now you can pass them in line command like this :

my_job_launcher.sh --context_param out_filename='output.txt' --context_param where_value='>7'

这篇关于talend - 参数化 tOracleInput 查询和输出命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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