• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] Tutorial for Updating a mysql table from an imported CSV file?

#1 2012-03-07 23:05:09

mitchgibbs
New member
Registered: 1970-01-01
Posts: 8

[resolved] Tutorial for Updating a mysql table from an imported CSV file?

Tags: [csv, etl, join, update]

Hi-

I feel like I've been running around in circles as I'm learning TOS and I was hoping someone could help break me out of the circles.

I'm using TOS to import several thousand CSV files with individual contact information into a mysql table. I've been able to do this part and it is working very reliably and it was remarkably easy.

Next, I've got several hundred files with flags to indicate individuals who have passed away. The deceased information is related to the other imported files on a compound key of two fields. I know I can import the deceased information into a table and then run SQL to update one table from the other. However, I'm hoping to avoid switching from ETL to ELT. However, I can't quite figure out how to do update an existing table from a CSV.

Can someone point me in the right direction?

Thanks!

Mitch

Offline

#2 2012-03-08 04:12:48

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Hi Mitch

Could you show me some example data? Input data? Output data?
Then i can reproduce this job for you to explain how to do this.

Regards,
Pedro


Only Paranoid Survive.

Offline

#3 2012-03-08 04:17:34

mitchgibbs
New member
Registered: 1970-01-01
Posts: 8

Re: [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Thanks very much for your help.

The input CSV file has:
Hospital|ID|Deceased
ASDF|123123|1
QWER|321321|1

The mysql database has:
Hospital|ID|First Name|Last Name|Deceased
ASDF|123123|John|Smith|0
ASDF|4545|Bob|Jones|0

I want to read the CSV file and update the mysql table when both the hospital and ID fields match.

Thanks again. You guys are awesome.

Mitch

Offline

#4 2012-03-08 04:29:35

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Hi Mitch

You can create a job like this.
tFileInputDelimited--row1-->tMap-->tMysqlOutput
                                                |
                                       look up(row2)
                                                |
                                       tMysqlInput

Filter the rows which row1.Hospital.equals(row2.Hospital) and row1.ID=row2.id.

Regards,
Pedro


Only Paranoid Survive.

Offline

#5 2012-03-08 04:43:31

mitchgibbs
New member
Registered: 1970-01-01
Posts: 8

Re: [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Thanks very much Pedro. I'm following you and I think I've got the structure in place now. However, I'm trying to figure out where the filter expression should go.

Mitch

Offline

#6 2012-03-08 04:46:01

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Hi Mitch

Set Hospital as String and ID as Int.
The expression should be

Code:

row1.Hospital.equals(row2.Hospital)&& row1.ID=row2.id

Regards,
Pedro


Only Paranoid Survive.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] Tutorial for Updating a mysql table from an imported CSV file?

Board footer

Powered by FluxBB