Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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
Hello,
This link you provided navigates to error page.
Do you want to implement data encryption/decryption feature using Context Framework?
Best regards
Sabrina
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
Hi @rhall,
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 .
Best regards
Jeans