Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all, I need your help regarding context variables in talend. So I have created this job to capture job details (like etl audit job)
My tDBRow has query:
"insert into public.jobs_exec(date_key,exec_key,job_id,job_status,start_time,end_time,src_count,tgt_count)
select CURRENT_TIMESTAMP,0,job_id,'" + context.job_status + "',CURRENT_TIMESTAMP, null,0,0
from public.jobs_property
where job_name ='" + context.job_name + "'"
this I have taken as sub-job in other job, where it is supposed to capture job execution details
so, the audit job is supposed to capture the details of this job and update it in db accordingly. Though manually I'm able to execute the query (of tDBRow ) and populate jobs_exec table, but it's not happening via talend ? Where is it it that i'm missing ? any help would be appreciated
Hi
"but it's not happenning via talend? "
What's the problem? Does the data are inserted correctly into DB when the query is executed on tDBRow?
one thing to note is that the value of context.job_name is the main job' name rather than child job's name in your example, you pass the main job's name to child job.
Regards
Shong
That's the issue - tDBRow query execution result data is not inserted into the db.
Yes, I do know that context.job_name is the main job name.
so, need to do more testing on your query, eg, use a tDBInput to execute this query
select CURRENT_TIMESTAMP,0,job_id,'" + context.job_status + "',CURRENT_TIMESTAMP, null,0,0
from public.jobs_property
where job_name ='" + context.job_name + "'"
and output them on the console to check if it has the right result.
tDBInput--main--tLogRow
the output has no result, it returns 0 rows
this explains that's why no data are inserted into DB if you execute the query on tDBRow
"insert into public.jobs_exec(date_key,exec_key,job_id,job_status,start_time,end_time,src_count,tgt_count)
select CURRENT_TIMESTAMP,0,job_id,'" + context.job_status + "',CURRENT_TIMESTAMP, null,0,0
from public.jobs_property
where job_name ='" + context.job_name + "'"
I got the answer, thank you for the response