Talend Create Table

Talend tCreateTable component is useful for creating a table in a database. We can use this tCreateTable to create a table before loading the output into the database.

In this Talend example, we create a job that loads data into this newly created SQL Server table.

Talend Create Database Table Example

Drag and drop the Talend tCreateTable from the palette to the job designer. From the below screenshot, you can see by default it is pointing to the MySQL database. This Component tab has all the properties required to connect with the MySQL database and create a table.

Talend Create Table 1

From the list of available Database types drop-down list, let me select the MS SQL Server as the Database type. Now, you can see the options to connect with SQL Server.

Talend Create Table 4

We just copied the tFilterRow job and pasted all the components into this job. I suggest you refer to the Talend tFilterRow article in Talend.

Next, we removed the OnSubjectOk trigger pointed it to tCreateTable, and connected the Main row of tCreateTable with tDBInput. It means that once the connection is established to the database, it will reach the tCreateTable, and then go to the tDBInput.

Within the Talend tCreateTable Component tab, we use the existing connection and then create a table named a1234. Here, the table action options are the same as the tDBOutput. So, please refer to Load data from the text file to the database article. We are selecting the Drop table if it exists and creates, which means it will drop the table if a1234 exists; otherwise, it creates a1234 table.

Please click on the Edit Schema button to create a schema or column name for the table you want to create. As you can see from the below, we create a schema that matches the Customer table that we selected in the tDBInput.

Edit Shcema to check the Columns

Within the tDBOutput, we changed the table name to a1234, and Action on the table to Truncate Table.

Assign a Unique Name

Let me run this Talend Create database table job.

Talend Create Table 10

From the below Management Studio screenshot, our job has created the table and stored the filtered data inside it. Within the SQL table properties, you can check the created date and time.

Result