Printing your input query

If your result set isn't as expected and you are struggling to understand why, then it is really useful to be able to see the query that was executed to give you the result. This recipe shows how this can be done.

Getting ready

Open the job jo_cook_ch07_0030_printInputQuery, which is a copy of the job from the previous recipe.

How to do it…

The steps to be performed are as follows:

  1. Add a tJava component.
  2. Add OnSubjobOk from tMysqlInput to tJava.
  3. Open tJava and add the following line:
    System.out.println("\nExecuted query: \n"+((String)globalMap.get("tMysqlInput_1_QUERY")));
  4. Run the job and you will see the query as it was sent to the database.

How it works…

As we have seen in other recipes, many of the Talend components will drop ...

Get Talend Open Studio Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.