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
Configuring the components
- You have created a database connection in the Metadata node of the Repository tree view.
- In the Basic settings view of the tMysqlInput, select Repository and the database connection from the Property Type list, in this example mydb_test.
- In the Table Name field, name the database table, in this example contact.
Click the Edit schema button to define the schema and
click the [+] button to add four columns,
City and Postal.
Set the Query Type as Built-In
and in the Query box, enter the query as follows.
- In the Basic settings view of the tMysqlOutput, select Repository and the database connection selected previously for the tMysqlInput, mydb_test.
From the Action on table list, select Create
table and click the Sync columns button
to synchronize the table schema with the input schema.
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
- Press Ctrl+S to save the Job.
- Press F6 to execute it.
The MySQL table contact have been created with the two additional Id and Name columns.