Skip to main content
Solved

How to add quotes around parameters values

  • September 30, 2022
  • 6 replies
  • 323 views

so_much_more
Supporter
Forum|alt.badge.img+6

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.

Best answer by nielsgerrits

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)"

 

View original
Did this help you find an answer to your question?

6 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • September 30, 2022

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)"

 


so_much_more
Supporter
Forum|alt.badge.img+6
  • Author
  • Supporter
  • September 30, 2022

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"

 

 

 


nielsgerrits
VIP
Forum|alt.badge.img+54
so_much_more wrote:

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?


dustin
Influencer
Forum|alt.badge.img+30
  • Influencer
  • September 30, 2022

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


david_r
Celebrity
  • September 30, 2022

Try:

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

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


so_much_more
Supporter
Forum|alt.badge.img+6
  • Author
  • Supporter
  • September 30, 2022
nielsgerrits wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings