Scenario 1: Removing and regenerating a MySQL table index - 6.1

Talend Components Reference Guide

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 Data Quality
Talend Open Studio for ESB
Talend Open Studio for MDM
Talend Real-Time Big Data Platform
Talend Studio
Data Governance
Data Quality and Preparation
Design and Development

This scenario describes a four-component job that removes a table index, applies a select insert action onto a table then regenerates the index.

Setting up the Job

  1. Select and drop the following components onto the design workspace: tAmazonMysqlRow (x2), tRowGenerator, and tAmazonMysqlOutput.

  2. Connect tRowGenerator to tAmazonMysqlOutput.

  3. Using a OnComponentOk connections, link the first tAmazonMysqlRow to tRowGenerator and tRowGenerator to the second tAmazonMysqlRow.

Configuring the tAmazonMysqlRow component

  1. Select the tAmazonMysqlRow to fill in the DB Basic settings.

  2. In Property type as well in Schema, select the relevant DB entry in the list.

    The DB connection details and the table schema are accordingly filled in.

  3. Propagate the properties and schema details onto the other components of the Job.

  4. The query being stored in the Metadata area of the Repository, you can also select Repository in the Query type field and the relevant query entry.

  5. If you didn't store your query in the Repository, type in the following SQL statement to alter the database entries: drop index <index_name> on <table_name>

  6. Select the second tAmazonMysqlRow component, check the DB properties and schema.

  7. Type in the SQL statement to recreate an index on the table using the following statement: create index <index_name> on <table_name> (<column_name>)

    The tRowGenerator component is used to generate automatically the columns to be added to the DB output table defined.

Configuring the output component

  1. Select the tAmazonMysqlOutput component and fill in the DB connection properties> either from the Repository, or manually for this specific use only. The table to be fed is named: comprehensive.

  2. The schema should be automatically inherited from the data flow coming from the tRowGenerator. Edit the schema to check its structure and check that it corresponds to the schema expected on the DB table specified.

  3. The Action on table is None and the Action on data is Insert.

Job execution

Press F6 to run the job.

If you manage to watch the action on DB data, you can notice that the index is dropped at the start of the job and recreated at the end of the insert action.

Related topics: tDBSQLRow properties.