• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tPostgresInput query context variables

#1 2009-05-06 22:33:54

recent!
Member
Registered: 2009-04-30
Posts: 13

tPostgresInput query context variables

I'm trying to add inputs from a Postgres database, but it creates the default query using the context variables for the database. This would be fine, except it errors and says the statement is incorrect.

Here is what it defaults to:
"SELECT \""+context.dbname_Schema+"\".\"tablename\".\"columnname\", \""+context.dbname_Schema+"\".\"tablename\".\"columnname2\"
+" FROM \""+context.dbname_Schema+"\"."tablename\""

I then have to manually redo the statement to look like this:
"SELECT tablename.columnname, tablename.columnname2 FROM tablename"

The context variables work for everything else, so it seems to be the query generation causing the problem.

Is there a way to make it default to the second method (while leaving the connection contexts intact), or at least make the default statement correct? I've been doing it manually so far, but each table has 30-40 columns making it very repetitive. I'm also reading from an Access database using context variables and tAccessInputs and it works fine, with queries looking like the second one above. If anybody has any suggestions it would be greatly appreciated.

Thanks,
Phil

Offline

#2 2009-05-07 00:55:43

JohnGarrettMartin
Member
Registered: 2009-01-07
Posts: 762

Re: tPostgresInput query context variables

Phil,
   Im not as experienced in postgres as I'd like to be. What is the exact problem with the statement that Talend generates with contexts?

Offline

#3 2009-05-07 02:47:45

recent!
Member
Registered: 2009-04-30
Posts: 13

Re: tPostgresInput query context variables

When I hit the ... to open up the query editor, it gives this message:

This query can not contain context parameters (like $_context)
or this query has not been enclosed by ".
or has some expressions. Please correct.

I think it's something in the syntax with the variables being used, possibly involving the quotations and escape characters. The error message doesn't narrow it down too much, so I've just been rewriting it as a simpler query so far. I'm fairly new to Talend and Postgres, so it could be something obvious that I'm overlooking.

Thanks,
Phil

Offline

#4 2009-05-14 08:46:04

Glen
Guest

Re: tPostgresInput query context variables

I have the same problem - and the error message is really not helpful at all.

In my case the same query runs perfectly in PgAdmin so it is not postgres that does not like the query.

#5 2009-05-14 09:32:45

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: tPostgresInput query context variables

Hello All

I then have to manually redo the statement to look like this:
"SELECT tablename.columnname, tablename.columnname2 FROM tablename"

The latest version TOS3.1.0 use this way.

Best regards

         shong


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#6 2009-05-14 09:52:58

Glen
Guest

Re: tPostgresInput query context variables

Yes I saw that in your post but even this SQL does not work:

select
invoice.invoice_id,
invoice_item.product_id
from
invoice_item join invoice on invoice_item.invoice_id = invoice.invoice_id

Absolutely basic SQL and I get the same cannot connect to DB or Guess Schema is incompatible error.

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » tPostgresInput query context variables

Board footer

Powered by FluxBB