This scenario describes a four-component job that removes a table index, applies a select insert action onto a table then regenerates the index.
Select and drop the following components onto the design workspace: tMysqlRow (x2), tRowGenerator, and tMysqlOutput.
Link the first tMysqlRow to tRowGenerator using an OnComponentOk connection.
Link tRowGenerator to tMysqlOutput using a Row > Main connection.
Link tRowGenerator to the second tMysqlRow using an OnSubjobOk connection.
Select the tMysqlRow to fill in the DB Basic settings.
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.
Propagate the properties and schema details onto the other components of the Job.
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.
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>
Select the second tMysqlRow component, check the DB properties and schema.
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.
Select the tMysqlOutput component and fill in the DB connection properties either from the Repository or manually the DB connection details are specific for this use only. The table to be fed is named: comprehensive.
The schema should be automatically inherited from the data flow coming from the tLogRow. Edit the schema to check its structure and check that it corresponds to the schema expected on the DB table specified.
The Action on table is None and the Action on data is Insert.
No additional Columns is required for this job.
Press Ctrl+S to save the Job.
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.