Six Stars

send data one after another to three tables in cyclic order

I have one source table,the data in source table,

I have 3 target tables T1,T2 and T3. I want the output as follows.

i want to load data,  

rows from  1-100 in T1, 

101-199 in T2

200-299 in T3 

again with cyclic order 

300 -399 in T1...



How an i Achieve that in talend?

Note: I am using Mysql database.



Re: send data one after another to three tables in cyclic order



In tmysqlinput, add an additional column to group the data into different buckets.


select (@a:=@a+1)%300 bucket, emp_id from employee, (SELECT @a:= 0) AS a order by emp_id;


You need to add a tmap after tmysqlinput and connect 3 tmysqloutputs as 3 output components of tmap.


For the first output table in tamp, add a condition in expression filter input_row.bucket>=1 && input_row.bucket<=100


Similarly, for second output table,add expression     input_row.bucket>=101 && input_row.bucket<=200


For third output table, (input_row.bucket>=201 && input_row.bucket<=299) ||  input_row.bucket == 0  

Please note that in third output table, you will have an additional clause to capture records with numbers like like 300, 600, 900 etc.


This should resolve your issue.


Please mark it as an acceptable solution if the suggestion has helped to resolve your query.


Warm Regards,


Nikhil Thampi