Controlling the Data Definition Language via tMysqlOutput when creating a table

author
Shicong Hong
EnrichVersion
6.5
EnrichProdName
Talend Big Data Platform
Talend Big Data
Talend Data Integration
Talend Data Services Platform
Talend ESB
Talend Open Studio for Data Integration
Talend Data Fabric
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
Talend MDM Platform
Talend Data Management Platform
Talend Open Studio for Big Data
task
Design and Development > Designing Jobs
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

Controlling the Data Definition Language via tMysqlOutput when creating a table

This article explains how to create a MySQL table with an AUTO_INCREMENT column and a UNIQUE one with tMysqlOutput component.

Creating the Job and linking the components

Procedure

  1. Drag and drop the following components from the Palette onto the design workspace: tMysqlInput and tMysqlOuput.
  2. Connect tMysqlInput and tMysqlOutput using the Row > Main link.

Configuring the components

Before you begin

  • You have created a database connection in the Metadata node of the Repository tree view.

Procedure

  1. In the Basic settings view of the tMysqlInput, select Repository and the database connection from the Property Type list, in this example mydb_test.
  2. In the Table Name field, name the database table, in this example contact.
  3. Click the Edit schema button to define the schema and click the [+] button to add four columns, Email, Phone, City and Postal.
  4. Set the Query Type as Built-In and in the Query box, enter the query as follows.
  5. In the Basic settings view of the tMysqlOutput, select Repository and the database connection selected previously for the tMysqlInput, mydb_test.
  6. From the Action on table list, select Create table and click the Sync columns button to synchronize the table schema with the input schema.
  7. In the Advanced settings view of the tMysqlOutput, add two external columns:
    • Id as MEDIUMINT PRIMARY KEY NOT NULL AUTO_INCREMENT
    • Name as VANCHAR(50) UNIQUE

Executing the Job

Procedure

  1. Press Ctrl+S to save the Job.
  2. Press F6 to execute it.

Results

The MySQL table contact have been created with the two additional Id and Name columns.