Scenario 2: Using StoreSQLQuery variable - 6.3

Talend Open Studio for Big Data Components Reference Guide

EnrichVersion
6.3
EnrichProdName
Talend Open Studio for Big Data
task
Data Governance
Data Quality and Preparation
Design and Development
EnrichPlatform
Talend Studio

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: