Skip to main content

I want be able to replace part of a generic table name with the current table name in the SQL statement within the sql transformer.

for example <LAST_YR_RIN_SCHEMA> with R_2017_01_01

is this something that can be done in the workbench?

i was told to use a private parameter but that wouldnt work and also to use a creator followed by attribute_creator followed by the sql_executor which is also not good as i only want to replace part of the table name not the entire name as shown in screen shot above.

thanks for your suggestions.

Hi @fbastian73, if you create an attribute that stores the entire SQL statement containing the placeholder '<LAST_YR_RIN_SCHEMA>', you can replace it with the StringReplacer and then set the attribute to the SQL Statement parameter in a SQLExecutor. This screenshot illustrates my intention.

Alternatively, you can also execute the @ReplaceString function in the SQLExecutor instead of using the StringReplacer, like this:


Where is your screenshot?

 

 


Hi @fbastian73, if you create an attribute that stores the entire SQL statement containing the placeholder '<LAST_YR_RIN_SCHEMA>', you can replace it with the StringReplacer and then set the attribute to the SQL Statement parameter in a SQLExecutor. This screenshot illustrates my intention.

Alternatively, you can also execute the @ReplaceString function in the SQLExecutor instead of using the StringReplacer, like this:

hi @takashi

 

sorry, i was sure the screenshot had attached. Here it is again.

 

I will try your suggestion and see how i go.

 

As you can see, i want to replace only part of the table name not the entire name.

 

 

thanks for your help.

 


hi @takashi

 

sorry, i was sure the screenshot had attached. Here it is again.

 

I will try your suggestion and see how i go.

 

As you can see, i want to replace only part of the table name not the entire name.

 

 

thanks for your help.

 

Thanks for posting the screenshot. I think that the method I suggested should also work even if the placeholder is only a part of the entire table name. If a single SQL statement contains two different placeholders, you can just use two StringReplacers in series.

 

 


Thanks for posting the screenshot. I think that the method I suggested should also work even if the placeholder is only a part of the entire table name. If a single SQL statement contains two different placeholders, you can just use two StringReplacers in series.

 

 

hi @takashi,

 

it has worked for me with the first method you mentioned.

 

thanks again.