Configuring the components - 6.5

MySQL

author
Talend Documentation Team
EnrichVersion
6.5
EnrichProdName
Talend Big Data
Talend Big Data Platform
Talend Data Fabric
Talend Data Integration
Talend Data Management Platform
Talend Data Services Platform
Talend ESB
Talend MDM Platform
Talend Open Studio for Big Data
Talend Open Studio for Data Integration
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
task
Data Governance > Third-party systems > Database components > MySQL components
Data Quality and Preparation > Third-party systems > Database components > MySQL components
Design and Development > Third-party systems > Database components > MySQL components
EnrichPlatform
Talend Studio

Procedure

  1. Set the tFileList component properties, such as the directory name where files will be fetched from.
  2. In the tMysqlConnection Component view, set the connection details manually or fetch them from the Repository if you centrally stored them as a Metadata DB connection entry. For more information about Metadata, see Talend Studio User Guide .
  3. On the tFileInputDelimited component's Basic settings panel, press Ctrl+Space bar to access the variable list. Set the File Name field to the global variable: tFileList_1.CURRENT_FILEPATH
  4. Set the rest of the fields as usual, defining the row and field separators according to your file structure.
  5. Then set the schema manually through the Edit schema feature or select the schema from the Repository. In Java version, make sure the data type is correctly set, in accordance with the nature of the data processed.
  6. In the tMap Output area, add two output tables, one called mum for the parent table, the second called baby, for the child table.
    Drag the Name column from the Input area, and drop it to the mum table.
    Drag the Years column from the Input area and drop it to the baby table.
  7. Make sure the mum table is on the top of the baby table as the order is determining for the flow sequence hence the DB insert to perform correctly.
    Connect the output row link to distribute correctly the flow to the relevant DB output component.
  8. In the Basic settings tab of the two tMysqlOutput components, select the Use an existing connection check box to retrieve the tMysqlConnection details.
  9. Set the Table name, making sure it corresponds to the correct table, in this example either f1090_mum or f1090_baby.
    There is no action on the table as they are already created.
    Select Insert as Action on data for both output components.
    Click on Sync columns to retrieve the schema set in the tMap.
  10. Switch to the Advanced settings tab of the DB output component corresponding to the child table (that is, f1090_baby).
    • In the id-baby row of the Additional columns table, fill the SQL expression field with "(Select Last_Insert_id())".
    • Set the Position field to Before.
    • Set the Reference column field to years.

    These settings allow the f1090_baby table to use the ID key of the f1090_mum as its key.

  11. Clear the Extend insert check box of both database output components.