• Index
  •  » Talend Enterprise Data Integration » General questions
  •  » CSV file versus 2 Tables comparison and insertion

#1 2012-02-07 11:36:02

ainiesta
Guest

CSV file versus 2 Tables comparison and insertion

Hi all, I have another question pls.

PROBLEM:
I have 2 tables (VALID, INVALID) and 1 CSV file.
I want to insert the CSV file into VALID table if it sees that there is no duplicate data in it. Otherwise, If upon entering of data and it sees that a duplicate item then it will enter to INVALID table.

by the way, I also created 1 column (statusCode) for both tables.
statusCode = 0 (duplicate)
statusCode = 1 (valid)


What and how is the best way to accomplish this.

Best regards.
Andres

#2 2012-02-07 15:55:37

kraval
Member
Registered: 2011-11-17
Posts: 28

Re: CSV file versus 2 Tables comparison and insertion

Hi there,

There's a component tuniqrow where in you can set the conditions for identifying a uniq row and you can set one of the outputs to table VALID and the rejects to table INVALID

csv >> tmap >> tuniqrow >> VALID
                              ||
                          INVALID


or you can replace tuniqrow by tmatchgroup and it will form groups of duplicates..

It all depends on whats your data that decides master record and duplicate record..

Offline

#3 2012-02-08 08:17:54

ainiesta
Guest

Re: CSV file versus 2 Tables comparison and insertion

Thanks.

But I need to compare first If the CSV file has records in the TABLE before inserting.

This is my scenario:

1. I want to insert CSV data to TABLE1 if there is no same existing records in that TABLE. (so this one i need to compare how i don't know?).
2. once compared and it sees that no duplicates will occur, CSV will populate that TABLE1. (how to pupulate this one based on number 1 scenario?)

Many thanks

#4 2012-02-08 17:44:58

kraval
Member
Registered: 2011-11-17
Posts: 28

Re: CSV file versus 2 Tables comparison and insertion

In that case, try using the component trecordmatch.

Unfortunately I am not able to upload a screenshot on this post. But here's the layout

TableVALID --->  tmap  ----
                                       || (lookup)
                                       v
CSV ---> tmap (main)---> trecordmatch ---> matches ---> DBout (TableINVALID)
                                                           ---> no matches ---> DBout (TableINVALID)


you can configure the trecordmatch to find matches based on your criteria of uniquesness.

Option 2 will be to configure a lookup within tmap which involves inneroins and lookups and conditional outputs. This is an easier(lazy) way to configure


Best,
Karan

Offline

#5 2012-02-09 03:56:50

ainiesta
Guest

Re: CSV file versus 2 Tables comparison and insertion

Hi There

tRecordMatch or trecordmathing --> I cannot find that component. I am using Talend Integrated Suite Professional Edition 4.1.1.
Is there any other component i can use in comparing csv and table and finding if there is duplicates before inserting?
Thanks

  • Index
  •  » Talend Enterprise Data Integration » General questions
  •  » CSV file versus 2 Tables comparison and insertion

Board footer

Powered by FluxBB