Reserved word in my postgres query throws an error in tPostgresqlRow

Four Stars

Reserved word in my postgres query throws an error in tPostgresqlRow

Hi,

 

I'm very new on Talend Open Studio for Data Integration version 7.  I have a query that throws an error.  How do you resolved reserved words in the query that runs throus tPostgresqlRow?

 

Select "current_schema", src_id from src_table

 

Thanks in advance!

Community Manager

Re: Reserved word in my postgres query throws an error in tPostgresqlRow

You need to escape the double quotes that you use to escape the reserved words. So, something like this....

"Select \"current_schema\", src_id from src_table"

The reason for this is that the queries used in Talend are actually Java Strings. Java Strings are surrounded by double quotes. To include a double quote, you need to escape it with a \.

 

Four Stars

Re: Reserved word in my postgres query throws an error in tPostgresqlRow

Thank you...

 

I also have a followup question.  

 

etl1.JPG

In tDBInput_1, I select all current_schema and src_sys_id and pass it through tFlowtoIterate_1.  Then I have tDBInput_4 that selects my input table and use the current_schema from tDBInput_1.  Whenever I run this, it's always null. I'm going crazy figuring this out.

 

etl2.JPG

Community Manager

Re: Reserved word in my postgres query throws an error in tPostgresqlRow

There are a couple of things wrong where you use your globalMap. First of all, the tFlowToIterate names the globalMap key using the row that feeds it and the column name. The row that feeds it is row4 not row1. The other issue is that you will need to cast that value from Object. The globalMap will default all objects to Object. To do this, just use the following code....

 

((String)globalMap.get("row4.current_schema"))

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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog