Talend Unique Row

The Talend Unique row or tUniqueRow field will remove duplicate rows or return distinct unique rows as an output. We can use this Talend Unique Row field if our source has the duplicate content.

In this Talend Unique row example, we used the Cutomer table available in our SQL Server database. The following screenshot shows the data inside that table.

Talend Unique Row 1

Talend Unique Row Example

First, drag and drop the DBConnection, DBCommit, and DBInput to establish a Talend connection to the SQL Server. Next, we selected the Customer table from the metadata.

Talend Unique Row 2

Next, drag and drop the Talend tUniqueRow from palette to job design. As you can see from the below tooltip, tUniqueRow makes a unique data flow based on the schema’s key set.

Talend Unique Row 3

Please connect the DBInput main row to tUniqueRow. Sometimes, the input columns will sync with the tUniqueRow. If that is not the case, then click on the Sync columns button.

Talend Unique Row 4

Next, click the Edit Schema button to check or alter the schema as per your requirements.

Talend Unique Row 5

Under the Components tab, there is a Unique Key section. It is the place where we specify the filed or column to be unique by checking the Key attribute. And if you want to check Case Sensitive, then checkmark that option as well.

For the demonstration purpose, let me check the Education column as the Key attribute. It means Talend Unique row will return the distinct Education columns from the Customers table.

Talend Unique Row 6

Next, we are using the DBOutput to store or save the Talend tUniqueRow output in a SQL Database. As you can see, we are creating or using the Talend_tUniqueRow table as the destination table.

Talend Unique Row 7

Let us run and see. From the below image, you can see, Talend unique row field is passing only seven records from 15 records.

Talend Unique Row 8

Please open the Management Studio and check the tUniqueRow output.

Talend Unique Row 9

The Talend Unique Row field will not restrict you from selecting a single field as the key attribute. You can select as many key fields as you want. For instance, we are selecting two columns Education and Occupation and run the job. It means tUniqueRow returns distinct Education and Occupation.

Talend Unique Row 10

You can see the Talend tUniqueRow output in SQL.

Talend Unique Row 11