talend - 参数化的 tOracleInput 查询和输出命名

talend - parameterized tOracleInput query and naming of output

我有一个视图作为 tOracleInput 和另一个输出组件(为简单起见,让天 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'