Passing Context Parameters from Command Line to Talend Job
Some times we have to pass context parameter value from commandline while executing talend job (.bat file or .sh file) which gets generated when we export job. We can make use of “–context_param” command in commandline to pass the context parameter values while executing talend job from command line.
Here is a simple job for passing the context parameters from commandline.
Make data easy with Helical Insight.
Helical Insight is world’s best open source business intelligence tool.
Place tjava component on working area, and under the component tab write a code to print the context parameter values as shown in below screen shot:
Declare the context Parameters and assign a defualt values under the Contexts tab for this job.
Here I have declared two context parameters as param1 and param2 and assigned default values as shown in the below screen shot:
Now if we execute this job from studio it will display these default values on the console as shown in the below screen shot.
If we execute this job from command line without providing the context parameters it will display the default values as follows:
Now execute the job by providing context variables in command line prompt. It will display these values as the output instead of default values as shown in the below output.
Make data easy with Helical Insight.
Helical Insight is world’s best open source business intelligence tool.
Here I passed ‘a1’ and ‘a2’ as the context parameter values for param1 and param2 context variables respectively.
Thanks and Regards,
Lalitha
Best Open Source Business Intelligence Software Helical Insight is Here