implicit context didn't construct code correctly when integrates with routine.

Highlighted
Five Stars

implicit context didn't construct code correctly when integrates with routine.

Regarding https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3...

I defined TalendContextTableName and TalendContextSchema on properties file.

Implicite context, I defined routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid) on Schema and routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextTableName",rootPid,pid) on Table Name.

On job, I switch to Code view and found it constructs a wrong java code as following.

String dbquery_Implicit_Context_Database = "SELECT \n  \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\".\"key\", \n  \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\".\"value\"\nFROM \"routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextSchema",rootPid,pid)\".\"_MyTable_\""+" WHERE "+routines.ImplicitContextUtils.getImplicitContextParameterValue("TalendContextEnvironment",rootPid,pid);

 

Do we have another way to let Talend Open Studio Version: 7.1.1 constructs the java code correctly when using routine define in parameter in implicit context?

 

Best regards,

Jeans

 


Accepted Solutions
Community Manager

Re: implicit context didn't construct code correctly when integrates with routine.

Hi @JeansBunt,

 

Thanks for looking at my blog and for highlighting this. I was using a MySQL database when I was writing this and did not have to specify a schema. I also, by pure chance, hard coded my table name. I therefore did not spot this problem. 

 

It turns out that the table name and schema do not appear to permit the calling of Java methods. They take whatever is written in those fields as literal values. This is rather frustrating, but does not stop you from making use of this functionality. It just means that you will need to hard code the table name and schema, leaving everything else dynamic. 

 

Sorry that I did not cover this in my tutorial. As I said, I will go back a edit this to make sure this is made clear. Thank you for highlighting it

 

@xdshi the link that was supplied is this one....

https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3

It looks like some extra url parameters were attached to the end 

 


All Replies
Moderator

Re: implicit context didn't construct code correctly when integrates with routine.

Hello,

This link you provided navigates to error page.

Do you want to implement data encryption/decryption feature using Context Framework?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Community Manager

Re: implicit context didn't construct code correctly when integrates with routine.

Hi @JeansBunt,

 

Thanks for looking at my blog and for highlighting this. I was using a MySQL database when I was writing this and did not have to specify a schema. I also, by pure chance, hard coded my table name. I therefore did not spot this problem. 

 

It turns out that the table name and schema do not appear to permit the calling of Java methods. They take whatever is written in those fields as literal values. This is rather frustrating, but does not stop you from making use of this functionality. It just means that you will need to hard code the table name and schema, leaving everything else dynamic. 

 

Sorry that I did not cover this in my tutorial. As I said, I will go back a edit this to make sure this is made clear. Thank you for highlighting it

 

@xdshi the link that was supplied is this one....

https://www.talend.com/blog/2019/02/28/best-practices-for-using-context-variables-with-talend-part-3

It looks like some extra url parameters were attached to the end 

 

Five Stars

Re: implicit context didn't construct code correctly when integrates with routine.

Hi @rhall_2_0,

 

Thank you for explanation. I agree with you that we need hard code to define a table_name.

 

However, your blog is really useful to support dynamics switch the job between environment by simply change ENV value. I'm appreciate your sharing. 

 

Hi @xdshi ,

Thank you for your reply. This link was updated by @rhall_2_0 .

 

Best regards

Jeans

Five Stars

Re: implicit context didn't construct code correctly when integrates with routine.

Hi @xdshi ,
Thank you for your reply. This link was updated by @rhall_2_0 .

In this case, I followed list of steps about best practices for using context variables that developed by @rhall_2_0. My issue struck on I'm unable to define table name as variable that passing from user define routine.

However, encrypt/decrypt is working fine using jasypt-1.9.2.

Best regards,
Jeans

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 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog