Talend Replicate

The Talend Replicate or tReplicate field is to replicate or duplicate the input source data into multiple copies. So that we can perform different operations on each copy. For instance, if we have the sales data by country, you can make a copy and perform aggregations on one copy and applying filters on the other copy.

In this example, we use this Talend Replicate transformation to create two copies of the source table and perform string replace and aggregate the numeric values.

Talend Replicate Example

To demonstrate the same, we are using the customers table in our SQL Database. From the below Talend screenshot, you can see the connection details and the table that I was using. I suggest you refer Connect Talend to SQL article to understand these settings.

Talend Replicate 1

Next, drag and drop the treplicate field from pallet to the design window.

Talend Replicate 2

Please connect the DBInput main row to the Talend replicate field. As you can see from the below image, there is nothing much you can do in the replicate component tab.

Talend Replicate 3

Click on the Edit schema button will open the following window. Here, you can check the input and output fields, and change as per your requirement. For us, it was perfect, so we kept as it is and click the ok button.

Talend Replicate 4

Next, we added the tReplace filed and connected the tReplicate main output to the replace filed. Next, we replace the Education with Btech and Occupation column value Management with Admin. Please refer Talend Replace article to understand this.

Talend Replicate 5

When you right-click on the Talend replicate field, it again showing the Main row option, which is not possible with any other field. Because all the fields have one Main row and replicate is for duplicating data or making copies.

Talend Replicate 6

Here, we attached the Main row to tAggregateRow field, which will perform aggregations. As you see from the below, we are grouping the Customers by Education, Occupation, and finding the Sum of yearly Income, Sales. Please refer Talend Aggregate article.

Talend Replicate 7

Next, we used two tDBOutput fields connected with the SQL database. For the data replacement, we are creating a new table Replciate_Replace.

Talend Replicate 8

For the aggregated data, we are creating a new table Replciate_AggregateRow.

Talend Replicate 9

Let us run and see. 

Talend Replicate 10

From the above screenshot, you can see, tReplciate is passing 15 rows to both the Replace and tAggregateRow fields, which means it is making a fresh copy of customers. Within the SQL Server, let us see the Replace data.

Talend Replicate 11

And the aggregated data is

Talend Replicate 12