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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

Migrating data in tables with foreign keys and auto-increment

We are going to migrate data from MS Access to MySQL.
The MS Acess table schema:
Table User
ID Name Sex
Table Record
ID MAINID Seq APPID Name
Table Application
ID Name
Record.MAINID is the foreign key to User.ID
Record.APPID is the foreign key to Application.ID
The MySQL table schema:
Table User
keyid name sex
(autoincrement)
Table Record
keyid userid applicationid name
(autoincrement)

Table Application
keyid name
(autoincrement)
Record.userid is the foreign key to User.keyid
Record.applicationid is the foreign key to Application.keyid
I create 3 FileInputs and 3 MySqlOutputs to migrate data to table User, Application and Record, one by one, by trigger onSubjobOK. But when migrating the data in Table Record, I cannot find the autoincrement keyid values in Table Application and User to map to userid and applicationid fields in Table Record.
Labels (2)
2 Replies
Anonymous
Not applicable

Hi,
I create 3 FileInputs and 3 MySqlOutputs to migrate data to table User, Application and Record, one by one, by trigger onSubjobOK. But when migrating the data in Table Record, I cannot find the autoincrement keyid values in Table Application and User to map to userid and applicationid fields in Table Record.

For auto-increment id, you can set Var in tMap to get a Numeric.sequence.
Best regards
Sabrina
alevy
Specialist
Specialist

Easiest way is to load the User and Application tables and then read them back as lookups to tMap to load the Record table. Otherwise, see https://community.talend.com/t5/Design-and-Development/MySQL-Childen-insert-after-Parent-insert-with....