Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

How to insert a parent and many child entries from a CSV file to mysql

Hi,
I'm stuck with a job in Talend. I need to insert an entry in parent table and many child entries for its parent from a CSV file. I have inserted record in parent and I dont know how to insert multiple records in the child table and it has a foreign key relation. All Ids, primary key, are auto incremented so i couldn't how to assign the foreign id to child table. I tried it with tJoin but I can only do it for manually assigning primary key. Kindly help and thanks in advance.

Thanks,
Senthil
Labels (3)
25 Replies
Anonymous
Not applicable

Hi Senthil,
I have tried to send the .zip file to you, but my outlook said "It is invalid address . So do you have other valid E-mail address except for @gmail.com?
You should register and log in as a Community member first, then you'll get a Image upload box that allows to uplaod screen captures and images up to 200KB. see my pic
Best regards
Sabrina
0683p000009MDs1.png
_AnonymousUser
Specialist III
Specialist III
Author

Hi Senthil,
I have tried to send the .zip file to you, but my outlook said "It is invalid address . So do you have other valid E-mail address except for @gmail.com?
You should register and log in as a Community member first, then you'll get a Image upload box that allows to uplaod screen captures and images up to 200KB. see my pic
Best regards
Sabrina

Hi Sabrina,
You can try this email id sennat_26@yahoo.co.in. I have tried the previous issue and now it is working fine. I will register and upload the job design soon.
I have few more doubts in the design.
1. As the master and child relationship is one to many, I have duplicate master entries in the input file. So duplicate records are getting inserted. I tired using tUnique before tMysqlOutput1 that is the master table and the unique is getting inserted but now the child entry is only one as I have made it unique. How I can overcome this issue.
2. To test the mysql rollback I hard coded the foreign key value in the child table (that is master entry id as 1 which does not exists). So correct error message is thrown by the child table but the master table entries are created and roll back is not happening. This testing is correct for mysqlrollback.

Kindly help me out.
Thanks,
Senthil
Anonymous
Not applicable

Hi Sabina,
I like to do same but not with any database. I want to retrieve lastinserted id from MDM.
Please help me to get that value.
Actually I have some data in XML and i want to add that to MDM.
ques 2) How can i insert multiple value to column
ex: name LanguageKnown
Vishal English,Hindi,Spanish
as Talend MDM provide (0...many) mapping and also in UI with dynamically adding more element.
It is nicely handle in talend UI but how to do it with XML to MDM though job?

Regards,
Vishal Bhuva
Anonymous
Not applicable

Hi vishalbhuva,
Would you mind opening a new topic for your issue and put it under "Talend MDM" category so that more people in community will see it and share their experience, solution, option with you, thanks a lot.
Best regards
Sabrina
Anonymous
Not applicable

Hi Sabina,
Is that fine,
http://www.talendforge.org/forum/viewtopic.php?pid=112489#p112489

PLs reply as soon as possible.

Regards,
Vishal Bhuva
Anonymous
Not applicable

Hello Sabrina,
Thanks very much for this example and the screenshots; a very helpful reference!
I was able to get my process working based on the examples you shared, with one minor change (that I thought I would share for other people interested):
For tMySQLOutput_1 in the example, I need to use Insert (rather than Insert or Update) and that requires me to go to the Advanced settings tab for that component and set the number of batch rows to 1. (By default, the number is set to 100 which ends up causing the last insert ID to return as a 0.)
I'm not sure if there is an easier way to do things, but I thought I would share anyway.
Thanks again.
Nate
Anonymous
Not applicable

I'm not sure if there is an easier way to do things, but I thought I would share anyway.


__________________________
ford repair huntington beach
Anonymous
Not applicable

I know this is an older thread, but it helped me tremendously so thank you very much to all who contributed.
The question from Senthil on 3/28/2013:
1. As the master and child relationship is one to many, I have duplicate master entries in the input file. So duplicate records are getting inserted. I tired using tUnique before tMysqlOutput1 that is the master table and the unique is getting inserted but now the child entry is only one as I have made it unique. How I can overcome this issue.
I was able to solve with a simple change:
In the first tMap, under the Lookup properties, next to "Lookup Model" change the value to "Reload at each row", this effectively re-executes the join query after each master row has been inserted, picking up the newly inserted row and avoiding a duplicate master record insert.
Hope this helps, cheers!
_AnonymousUser
Specialist III
Specialist III
Author

Hi Sabrina,
I know this post is old, but i am facing the same problem (master-detail), so could you send me the sample to my email?. Let me know what is yours for requesting you by that way.
Thanks a lot!
Best regards
Anonymous
Not applicable

I share a variation i needed to get a value from the first tMap not mapped to first insert needed on second tmap
0683p000009MEB4.png 0683p000009ME5N.png 0683p000009ME40.png