talend - parameterized tOracleInput query and naming of output

孤街醉人 提交于 2019-12-08 09:39:45

问题


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


回答1:


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'


来源:https://stackoverflow.com/questions/42513036/talend-parameterized-toracleinput-query-and-naming-of-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!