Compare CSV file versus DB Records

One Star

Compare CSV file versus DB Records

Hi there,
New Talend user here. First day of using Talend Integration Suite 4.1.1. I am trying to compare and validate a CSV file versus records in MSSQL DB Table. Do you have any idea how to do this in a nice way? Or i would very much appreciate if you can provide me sample screenshot on the components involve.
Best Regards,
Andres
One Star

Re: Compare CSV file versus DB Records

Hi,
You can use the components tFileInputDelimited for the csv file and tMSSqlInput for the DB table and then use tMap. Make sure to inner join the map and map all fields that you want to compare.
Then create 2 output components. The first output could contain the matched records and the second output could contain the non-matched records. You can catch these non-matched records with the "catch inner join rejects" option in the output.
Good luck
One Star

Re: Compare CSV file versus DB Records

Good Job! many thanks
One Star

Re: Compare CSV file versus DB Records

Thanks. I was able to do this.
My next problem is, If there is no data in that Table I want this CSV file to populate that table.
how to do this using this scenario:
CSV(tFileInputDelimited) ----> tMAP <---- Table (tMSSLQInlput)
One Star

Re: Compare CSV file versus DB Records

Hi,
As saukema said, create a new ouput which will catch the reject. Put your csv as a source and your table as a lookup.
One Star

Re: Compare CSV file versus DB Records

I already did that. This solution only compares. It does not insert to DB.
see here:
CSV(tFileInputDelimited) ----> tMAP <---- Table (tMSSLQInlput)
| |
| |
tFileOutputDelimited1 tFileOutputDelimited2
wit this scenario, how can i insert the result to TABLE.
One Star

Re: Compare CSV file versus DB Records

Link your output reject to a tMSSQLOutput.
One Star

Re: Compare CSV file versus DB Records

Thanks. it is now working.