Modify context variable permanently

Six Stars

Modify context variable permanently

Hi,

 

Is it possible to modify a context variable within a job, so I can use the newest value of the context variable the next time I run the job?

 

I would like to use this feature to store the last time the job has run btw.

 

Thanks.


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Modify context variable permanently

Use tContextDump to overwrite the context file with the current values for all the context variables.


TRF
Fifteen Stars TRF
Fifteen Stars

Re: Modify context variable permanently

This view is usefull only when running jobs from the Studio.

As soon as you'll run the jobs from the command line or a scheduler, you'll have to manage 1 or more context files which can be overwritten at runtime bt the jobs.

During the development cycle, it's a good practice to use a context file to avoid any surprrise after job deployment.

Have a look to the documentation or search for "implicit context" or something like that.


TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Modify context variable permanently

Use tContextDump to overwrite the context file with the current values for all the context variables.


TRF
Six Stars

Re: Modify context variable permanently

A context file? I'am new to Talend so I don't really know what a context file is, I'am just using the view under my job for setting the context variables and I preferer to keep it this way so I don't have to create other seperate files on my computer.
Fifteen Stars TRF
Fifteen Stars

Re: Modify context variable permanently

This view is usefull only when running jobs from the Studio.

As soon as you'll run the jobs from the command line or a scheduler, you'll have to manage 1 or more context files which can be overwritten at runtime bt the jobs.

During the development cycle, it's a good practice to use a context file to avoid any surprrise after job deployment.

Have a look to the documentation or search for "implicit context" or something like that.


TRF
Six Stars

Re: Modify context variable permanently

I tried to override the context variable with a tJava but when i use a tContextDump it stills printing the old value in the file. How I can overcome this?
Fifteen Stars TRF
Fifteen Stars

Re: Modify context variable permanently

Share your job design and tJava piece of code


TRF
Four Stars

Re: Modify context variable permanently

I have tried tcontextDump with tjavaRow and tContextLoad.
The log is succesfull but after running the job the context variable does not get updated...

The idea is to store in the context variable the last time the job run in order to load only the delta
Four Stars

Re: Modify context variable permanently

CaptureTL.PNG

The code of tJavaRow is the following:

output_row.key = input_row.key;
output_row.value = input_row.value;
if(output_row.key.contains("date"))
{
output_row.value = "Hello";
}

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads