Scenario 2: Using StoreSQLQuery variable - 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

StoreSQLQuery is a variable that can be used to debug a tDBInput scenario which does not operate correctly. It allows you to dynamically feed the SQL query set in your tDBInput component.

  1. Use the same scenario as scenario 1 above and add a third component, tJava.

  2. Connect tDBInput to tJava using a trigger connection of the OnComponentOk type. In this case, we want the tDBInput to run before the tJava component.

  3. Set both tDBInput and tLogRow component as in tDBInput scenario 1.

  4. Click anywhere on the design workspace to display the Contexts property panel.

  5. Create a new parameter called explicitly StoreSQLQuery. Enter a default value of 1. This value of 1 means the StoreSQLQuery is "true" for a use in the QUERY global variable.

  6. Click on the tJava component to display the Component view. Enter the System.Out.println("")command to display the query content, press Ctrl+Space bar to access the variable list and select the global variable QUERY.

  7. Go to your Run tab and execute the Job.

  8. The query entered in the tDBInput component shows at the end of the job results, on the log:

    For an example of the use of dynamic schemas in Input components, see Scenario 4: Writing dynamic columns from a MySQL database to an output file.