How to read query result and put the output into a txt file

Seven Stars

How to read query result and put the output into a txt file

Hi,

 

I need to call a stored procedure from talend and then putting the output into a .txt file. How can I do that? Does anyone can help me please? I know ho to call the procedure but I do not know how to store the result in order the put the output in a txt file. I am using Postgres as DB.


Accepted Solutions
Nine Stars

Re: How to read query result and put the output into a txt file

Hi,

 

have a a look at the tParseRecordSer component.

 

thanks

 

david.

Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.

All Replies
Nine Stars

Re: How to read query result and put the output into a txt file

Hi,

 

have a a look at the tParseRecordSer component.

 

thanks

 

david.

Regards David
Dont forget to give Kudos when an answer is helpful or mark the answer as the solution.
Seventeen Stars

Re: How to read query result and put the output into a txt file

You can also use a tPostgresqlInput component because PostgreSQL allows to call a procedure with a select!

select field_1, field_2 from my_procedure()
Seven Stars

Re: How to read query result and put the output into a txt file

Hi,

thank you for your response. I am trying to use it, but I am getting the following error: "Cannot Cast from String to Result Set". I am doing a simple select from myTable which as one column of varchar2. As database I am using Postgres.

 

My job is dbTable (input) -> tParseRecordSet -> tFileOutputDelimited

Seven Stars

Re: How to read query result and put the output into a txt file

writingdata.png

This is my new job. I added tMap. I did not get the error anymore, but output file has not been created. Is there a reason? Am I doing something wrong?

Than you in advance.

Seven Stars

Re: How to read query result and put the output into a txt file

I am sorry! I tried again and I am getting the same error now
Seven Stars

Re: How to read query result and put the output into a txt file

[solved]

 

I solved the issue. The job is made up of tPostgresqlInput linked to tInputFileDelimeted and it works. Pay attention to " " in Row Separator and Fiel Separator of tInputFileDelimeted.

2019 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Modern Data Engineering in the Cloud

Learn about modern data engineering in the Cloud

Watch Now

How to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud reg...

Learn how to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud registries

Blog

Talend API Services Publish to Talend Cloud

Learn how to publish your API Services to Talend Cloud

Watch Now