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
Eight 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 the solution.

All Replies
Eight 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 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.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.