Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How do I make sure that I do not duplicate data being copied from a flat file to a sql table
I am reading a txt file going thru logrow and then writing to a sql table. The process works but every time I run it the same data gets inserted into my sql table
I know when writing to a txt file you have the option of append or rewrite .. is there such an option for writing to sql
Tom
there are many ways to achieve the same goals:
Hi Tom
with files the same - if you will append same information, it will be duplicated and in files as well
but you could save in database row number - add column and populate it by talend sequence
on next time - you will need request max row from table and start read the file from NNN+1 (header section of tFileInputDelimited)
you could also add more logic:
Thank you for the quick response .. I understand the thought that the data could be duplicated if the input file was used multiple times. Which is what I see when I run the job more then once. Is there a way to parse the data itself either via Talend or SQL to stop duplicate rows from being added. I am trying to learn and become more proficient so any support is very welcome
Tom
there are many ways to achieve the same goals:
This is not a production environment of any sort just me trying to learn how to write to a sql db. One idea that came to me was the use of Line id and adding logic to verify the new data line id versus the largest one in the db itself. What I am finding in developing in Talend is looking at all the ways that the data needs to be handled prior to ingestion
Tom