Prerequisites
In this example, there are two data sources: a text file named in.txt and a table named person in a Mysql database. The data of each data source are read as follows:
in.txt
id;name;sex
1;Shong;boy
2;Ross;boy
3;Sabrina;girl
4;Elisa;girl
user_id | name | country | |
---|---|---|---|
1 | Shong | CN | Shong@talend.com |
4 | Elisa | FR | Elisa@talend.com |
This example reads the data from the in.txt file as a main flow, and then does an inner join with the data read from the person table on a tMap component based on the id column from the file and the user_id column from the table. The join will get rows, including the external columns from the lookup table, if the id already exists in the table, and will reject rows if the id does not exist in the table.
Here is the expected output:
id | name | sex | |
---|---|---|---|
1 | Shong | boy | Shong@talend.com |
4 | Elisa | girl | Elisa@talend.com |
id | name | sex |
---|---|---|
2 | Ross | boy |
3 | Sabrina | girl |
Configuring the components
In this Job, you will perform an inner join between the two incoming data flow, generate two output tables, one table for the matched rows, and another for the unmatched rows.
This Job will use the following components:
- a tFileInputDelimited component to read data from in.txt file,
- a tMysqlInputDelimited component to read data from person table,
- a tMap to perform an inner join and generate two output tables,
- and two tLogRow components to print output data on the console.
Procedure
Doing an inner join with the tMap component
When double-clicking the tMap component, the following schema will display: