The Talend unite component helps you to unite or merge the data from different files or different sources and produce one output. The Talend unite field is very helpful in real-time. For instance, if we are getting sales data from different store stores, and we want to combine that data and store it in a Database.
In this example, we are combining three text files that contain customer data. The following screenshot will show you the data present in those text files.
As you can see from the below Talend screenshot, we have already created metadata for all the text files that we showed above.
Talend Unite or Merge Example
Let me drag and drop those three customer text files metadata into the design window and select file input Delimiter as the component.
Next, drag and drop the tunite component into the design space. You can see the tooltip from the below screenshot tunite merges inputs into the same output.
Let me join the main output lines of three text files to Talend tunite component. You can see from the below there is a merge order 1, 2, and 3. It entirely depends upon the way that you connected to Talend unite field. However, you can change that merge order by joining the required file output as the first.
Within the components table, the tunite field, there is nothing much you can do except editing the schema. Most of the time, Talend will sync the columns from the input field. If that is not the case, please click on the sync columns button.
Next, click on the button that we marked in the image. It will open the following schema editor window where you can change the order of the columns or delete the specific columns. Or, you can alter the length or precision of the input columns. Within the left side of the window, you can see three tabs that represent three input files. You can click on each tab to view the components and their order etc. Once you completed the changes, please click on the Ok button.
Let me use tLogRow to show the Talend Unite field output.
Once you click the Run button, you can see the output or the tLogRow output data.
I think I will put the tUnite output in a Database table. For this, we used the Talend_Unite table and the Action on the table as a Drop table if it exists and create option. If you have any doubts or when you are using the existing table, click on the Edit Schema button and check the input and output schema. Here, we are creating a new table, so we don’t have to see the schema.
Let’s run the Talend Unite Job and see
Well! No errors. Let me open the SQL Management studio to check the data inside the Talend Unite table.