One Star

Check if row is inserted or updated

Hi,
I make a job for read a txt file and write a mysql table.
I want write a log line for each row inserted and each row updated.
I know how write the number of total row with NB_LINE_INSERTED but i want the details of row inserted.
Thx
4 REPLIES
Moderator

Re: Check if row is inserted or updated

Hi,
i want the details of row inserted

Are you referring to Traces debug mode?
TalendHelpCenter:How to run a Job in Traces Debug mode
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Check if row is inserted or updated

Debug mode is not useful for my job.
I want write in log file whats is updated or inserted for further analisys and for re-launch the job with only the rows not inserted or updated
Thanks
Fifteen Stars

Re: Check if row is inserted or updated

Hi Saxmor,
Do you let the t{database}Output component decide whether to Insert or Update? If so, then this will not be a case of simply switching on a parameter. What you are asking is a pretty unusual requirement as logging the action of each row being Inserted or Updated will massively impeded the performance, unless you do it in a clever way. For example, do you have control over the structure of the table being imported into? If so, can you add a an insertDate and updateDate column? Also, does a key that exists in your flat file exist in your db table? With this, you can add a time stamp of when your data was inserted or updated (identifying the Insert or Update for each row for that run) and then you can link back to your original data file using the key. The insertDate and updateDate columns can be set to only be written to if the record is inserted (for insertDate) or updated (for updateDate) using the Advanced settings of the t{database}Output component.
Talend does not provide an option to solve this problem "out of the box", but you can work one in quite easily, as described above
Regards
Richard
Rilhia Solutions
One Star

Re: Check if row is inserted or updated

Thanks for the reply.
Maybe it's a solution, now i try Smiley Wink