简体   繁体   中英

How to dump data in table from CSV file using talend by manually increment in id as Max(id)+1 for each row in csv

I am trying to perform ETL Talend Job where I have records in csv file and have to Dump those records in table. My table has Primary key column ie Id. CSV file does not have Id column. So I have to get max(Id)+1 from table and insert the csv rows one by one with incremental id for each row.

Tried Setting Max(Id) into global variable and increment this id as id+1 in Tmap for each row. But It does not get increment for each record in Csv file

You can create a sequence in your database. Create a view of your sequence and import as a lookup table in Talend. Using TMap, pass the column to your ID. Let me know if you face any issues or further details.

在此处输入图片说明

Note: Make sure you make Reload at each row in Lookup Model so that new id gets generated for each row.

Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM