Hi,
We are planning to implement the Incremental Extract, our source is SqlServer and Target is Oracle.
In our source DB we have column called timestamp, using this column i have to perform a incremental load.
Each time when the job runs i have to capture the maximum value of the timestamp and i will be using that particular value during my next run dynamically. So i have created a context as Last_Run_Timestamp which should dynamically capture the max value of the Timestamp.
In order to do this,
In the tMSsqlInput component wrote a query as "select max(timestamp) from <tablename>", after that i have made this as input to tjavarow where i wrote a code as
context.Last_Run_Timestamp=row2.Timestamp
but the context is not getting updated...!!!
Thanks
Arul
Hi,
Thanks for the reply..
Am able to get the Max(Timestamp) value in my Subjob. Next step would be i have to store it a Context Variable.
As suggested i have written a code in tjava_row as
Last_Row_Timestamp=input_row.Timestamp.
When i print the context variable value am getting correct output. But, when i use that context variable in Main job where clause as
where Timestamp> "+context.Last_Run_Timestamp+" am getting the following error.
The requirement would be get the max(Timestamp) value in the Subjob, store that in a Context Variable(Last_Run_Timestamp)
Use that Context Variable in the Main Job(Where Clause) during the Next Run, to get the record greater than the previous run Date.
connected
Exception in component tMSSqlInput_3
java.sql.SQLException: Incorrect syntax near '>'.
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1304)
at dw_dev.copy_of_test_timestamp_child_0_1.Copy_of_Test_Timestamp_Child.tMSSqlInput_3Process(Copy_of_Test_Timestamp_Child.java:1393)
at dw_dev.copy_of_test_timestamp_child_0_1.Copy_of_Test_Timestamp_Child.runJobInTOS(Copy_of_Test_Timestamp_Child.java:1777)
at dw_dev.copy_of_test_timestamp_child_0_1.Copy_of_Test_Timestamp_Child.main(Copy_of_Test_Timestamp_Child.java:1639)
disconnected
Job Copy_of_Test_Timestamp_Child ended at 07:26 06/01/2014.
so if I understand your need you have to pass value to a "parent job". for that use bufferOutput component and in the Main job retrieve schema and value with copy child job schema. hope it helps regards laurent
Hi, I went through threads with tBufferoutput, am little confused. Can u please provide a screen shot of how to implement this. That would be really helpful. Thanks
here some explanation :
main job call child job that read the max value of something and return result to main job.
in my test the context param "MAX" default value = NULL .
Child job get the value from sql query and return this value via buffer output to main job.
Then Max Value of main job is now = to the value passed by child job ...
Starting job main at 15:23 06/01/2014.
connecting to socket on port 3609 connected 2013-12-16 disconnected Job main ended at 15:23 06/01/2014.
Hi, I want to iterate a workflow where I want to select a particular column from a csv file depending upon value of context variable, say i. So at first iteration, i =1 so i want to select column named t1. At the end of first iteration, my i becomes 2 (using tjava component here). Now I want to select column named t2. But when I use tjavarow for getting the value of column from column in csv, it doesn't allow me to write context.col_name = input_row."t"+i. (ultimately I want input_row.t2). How can I do this job in Talend? Thanks and regards, Himani