harish_sng
harish_sng

Reputation: 435

Using Talend ETL tool, How to insert a non existing record to MySQL table from Excel Sheet?

I have an excel sheet column in which I need to insert only non existing records. Example: list of university
1. Sri Krishnadevaraya University
2. Sri Krishnadeveraya University(SKU)
3. St Jerome University
4. St.Peters University

table already have "St.Peters University" so I need to insert
1. Sri Krishnadevaraya University
2. Sri Krishnadeveraya University(SKU)
3. St Jerome University.

Upvotes: 1

Views: 747

Answers (3)

Ptyler649
Ptyler649

Reputation: 69

in talend you would use the components tfileinput-->tlogrow-->tmap--tlogrow-tmysqloutput. Any filter / transformations / business logic can be done in the tmap component.

Upvotes: 1

tobi6
tobi6

Reputation: 8239

If you write to MySQL, you are using the tMySQLOutput component - I am only assuming here because there are no information about the job layout whatsoever.

Since MySQL has a feature called insert ignore, you should focus on

  • setting a good valid primary key (Ignore checks if the PK exists)
  • setting the insert strategy to insert ignore in the component

Upvotes: 1

Tom
Tom

Reputation: 1030

SELECT  *
FROM    *
WHERE   NOT EXISTS
        (
        SELECT  * 
        FROM    *
        WHERE   * = *
        )

Not too familiar with Talend but this post is quite useful :

Talend Insert where not exists

Upvotes: 1

Related Questions