Retrieve Schema from custom SQL query (Component tPostgresqlInput)

One Star

Retrieve Schema from custom SQL query (Component tPostgresqlInput)

Hi,
I am using Talend Open Studio / Date Integration some time in order to read/write database tables. Now I have to read data through a custom SQL query from Postgres.
Job Definition: tPostgresqlInput --> tFileOutputExcel
Database Connection o.k.
Job Run counts the exact number of rows.
Everything looks fine, Job completes, but XLSX-file ist empty. Warning message says sth like "no schema given" and "schema is different from the query" in component tPostgresqlInput.
Klicking "guess schema" in component basic settings seems to make nothing.
Is it possible at all, to automatically retrieve the schema from a custom query?
Thanks in advance.
Moderator

Re: Retrieve Schema from custom SQL query (Component tPostgresqlInput)

Hi,
Everything looks fine, Job completes, but XLSX-file ist empty. Warning message says sth like "no schema given" and "schema is different from the query" in component tPostgresqlInput.
Klicking "guess schema" in component basic settings seems to make nothing.
Is it possible at all, to automatically retrieve the schema from a custom query?

It is possible to automatically retrieve the schema from a custom query. Such as "Select * from table name", and then click the "guess schema" button in component basic settings.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Retrieve Schema from custom SQL query (Component tPostgresqlInput)

Hi Sabrina,
thank you for your reply. Is this solution valid for any type of query? I tried "guess schema" several times (in several configuration variations) - without succes. There shows up a dialog and disappears before I can read.
By the way, my query is not a plain select from one table, but a complex statement with a dozen joins, aggregates, subqueries, resulting in about 200 columns.
I configured Postgresql server 8.4 to log ALL queries and found out, that there is no query sent to Postgresql server when pressing "guess schema".
Kind regards
Moderator

Re: Retrieve Schema from custom SQL query (Component tPostgresqlInput)

Hi,
The button of "Guess Schema" can guess the column structure of table by sql query but not multiple SQL statement.
See the related forum Forum 30059.
You can use a simple query to check if the "guess schema" option works well?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.