MS SQL queries in Talend Cloud Management Console log

Highlighted
Five Stars

MS SQL queries in Talend Cloud Management Console log

Hi Everyone.

 

How can I log the MS SQL queries to the TC Management Console?

I would like to write the query to the log (only query, without rows/results).

I use the tDBInput component and the flow is very simple:

tDBInput(MSSQL)---->tJavaRow ----->tDBOutput

 

I know that for some DB technology (for example Snowflake) the queries (tDBInput and tDBRow) are written to the log automatically but for MS SQL is doesn't work.

 

 

Regards. 


Accepted Solutions
Highlighted
Community Manager

Re: MS SQL queries in Talend Cloud Management Console log

Hi
Use the tJobLog component in the job and customize the log messages, eg:
"This is the query: "+context.query

Note that:
To be able to use this component to generate logs, you must enable the Log4j option in the project settings in the Studio.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post


All Replies
Highlighted
Employee

Re: MS SQL queries in Talend Cloud Management Console log

Hi,

 

    The most easy way will be store the query in a context variable and print it using a tJava.

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved

Highlighted
Five Stars

Re: MS SQL queries in Talend Cloud Management Console log

 Hi nikhillthampi.

 

Maybe I'm wrong but simple System.out.println(context.query) puts the query into the output.

But I would like to see the query in the Cloud log.

How can I do it?

 

Regards.

 

Highlighted
Community Manager

Re: MS SQL queries in Talend Cloud Management Console log

Hi
Use the tJobLog component in the job and customize the log messages, eg:
"This is the query: "+context.query

Note that:
To be able to use this component to generate logs, you must enable the Log4j option in the project settings in the Studio.

Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

View solution in original post

Highlighted
Five Stars

Re: MS SQL queries in Talend Cloud Management Console log

Thanks a lot.

 

I did as you both wrote and it looks ok.

 

I thought that there is more easier and shorter way to do it so this is why I asked.

Right now If I want to add some log entries/details in a few places in job, it is necessary to add a lot of components to the job.

For example, if I have 10 different queries to run in one job in different places I need to add 10 additional tJava component and 10 additional tJobLog component.

This makes the job difficult to read.

It would be great to have some java function to write some logs (context variables) in both places - to the output and to the cloud log (web).

Do you know if there is something like this?

 

Thanks.

 

 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Downloads and Trials

Test drive Talend's enterprise products.

Downloads