Skip to main content

I want to run a SQL before a writer to a postgis database.

I am using parameters to dynamically run the SQL queries. Since SQL is case sensitive and my tables include case characters I need to put quotations around my table names. But putting quotes around my statement make it a string. I just want to add quotes the parameters value.

select * from "$(schema)"."(fme_feature_type)"

Desired result

select * from "MySchema"."A_Table"

 

Is there a way to escape the quotes somehow to just add quotes around the paramaneter value.

The published parameter should work this way. If you want the fme_feature_type part dynamic, you need to use.

select * from "$(schema)"."@Value(fme_feature_type)"

 


I have tried that too. But FME execute it as 

Error executing SQL command ('Select * from MySchema.MyTable'):
'ERROR:  relation "MySchema.MyTable" does not exist'

I need the quotes to be part of the statement 

Select * from "MySchema"."MyTable"

 

 

 


I have tried that too. But FME execute it as 

Error executing SQL command ('Select * from MySchema.MyTable'):
'ERROR:  relation "MySchema.MyTable" does not exist'

I need the quotes to be part of the statement 

Select * from "MySchema"."MyTable"

 

 

 

Does it work when you use an AttributeCreator to create the code and put the attributevalue in the SQLCreator?


I suppose you could create the SQL query in an AttributeCreator as it is now. Then in a StringReplacer after that, replace . with "."


Try:

    select * from "$(schema)"."@Value(fme_feature_type)"

Be aware that the name of the published parameter is case sensitive.


Does it work when you use an AttributeCreator to create the code and put the attributevalue in the SQLCreator?

In closer inspection I think it actually work to do what you originally suggested. Not sure where i looked wrong. But it seem to be solved. It just look in the SQL dialog that the parameter will be evaluated as a string. Great! Thank you


Reply