问题
I have a view as a tOracleInput and another component for output (lets day tOutputDelimited for simplicity purpose).
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.
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