0% found this document useful (0 votes)
61 views28 pages

Load Questions

This document provides steps to load data from multiple source files or tables into different target files or tables using Talend. It includes examples of loading records based on conditions, splitting files based on a round robin technique, and aggregating/denormalizing data. The procedures outlined use common Talend components like tFileInput, tMap, tFilterRow, tAggregateRow, and tLogRow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views28 pages

Load Questions

This document provides steps to load data from multiple source files or tables into different target files or tables using Talend. It includes examples of loading records based on conditions, splitting files based on a round robin technique, and aggregating/denormalizing data. The procedures outlined use common Talend components like tFileInput, tMap, tFilterRow, tAggregateRow, and tLogRow.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Talend Tutorials & Scenarios Prepared by Venkat Rathnam Tekuri

I have Two Tables in SQL Named SRC_ACCOUNT_PRI and SRC_ACCOUNT_SEC as


Follows how to get the below output by using Oracle and Talend(Id’s is the
primary key in the both’s table.
Source:

Target:
Oracle Query:
SELECT * FROM SRC_ACCOUNT_PRI WHERE ID=101
UNION
SELECT * FROM SRC_ACCOUNT_SEC WHERE ID=101
Procedure (Design Steps in Talend):
Source1.txt
ID,NAME,ADDRESS,COUNTRY
101,VENKAT,BANGALORE,INDIA
102,RATHNAM,KOLKATA,INDIA

Source2.txt
ID,NAME,ADDRESS,COUNTRY
101,VENKAT,PUNE,INDIA
102,RATHNAM,CHENNAI,INDIA
Target:
I have designed three sub jobs as per the below in talend Designer.
Each sub job you will get the correct answer

Procedure:
Method1:

 I have designed three sub jobs as per the below in talend Designer.
 Drag and Drop two source Metadata tFileInputDelimited components, Unite and
tLogRow Target Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.

 Double click the Second tFileInputDelimited and verify the properties.


 Double click the tUiteComponent and sync columns .

 Double click the tFilterRow and Define the condition .

 Double click the tLogRow Component and Select the Radio button Table(Print Values
in Cells of a table).
I have One Source File I want to load into two tables in that one table even
numbers and another target table odd number records .
Source:
EMPNO,ENAME,JOB,SAL,DEPTNO
1,VENKAT,SSE,5000,10
2,RATHNAM,TL,6000,20
3,TEKURI,MANAGER,8000,30
4,TEKUR,MANAGE,1000,30
5,TEKU,MANAG,2000,20
6,VENKAT,SSE,4000,10
7,RATHNAM,TL,3000,10
8,TEKURI,MANAGER,7000,20
9,TEKUR,MANAGE,10000,30
10,TEKU,MANAG,9000,30
11,TEKU,MANAG,1500,20
12,TEKU,MANAG,2500,10

Target1:
Target2:

Procedure:
 I have designed three sub jobs as per the below in talend Designer.
 Drag and Drop the source Metadata tFileInputDelimited component , a tMap and two
tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.

 Double click the tMap Component and copy the input columns into two output
columns and write the enable /Disable expression filters.
Even Numbers Enable /Disable Filter=>Mathematical.MOD(row1.EMPNO ,2) ==0
Odd Numbers Enable /Disable Filter=> Mathematical.MOD(row1.EMPNO ,2) !=0
 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

EMPNO,ENAME,JOB,SAL,DEPTNO

101,VENKAT,SSE,5000,10

102,RATHNAM,TL,6000,20

103,TEKURI,MANAGER,8000,30

104,TEKUR,MANAGE,1000,30

105,TEKU,MANAG,2000,20

106,VENKAT,SSE,4000,10

107,VENKAT,SSE,4000,10

I have One Source File I want to load into three targets based on round robin
technique.
Source:
EMPNO,ENAME,JOB,SAL,DEPTNO
101,VENKAT,SSE,5000,10
102,RATHNAM,TL,6000,20
103,TEKURI,MANAGER,8000,30
104,TEKUR,MANAGE,1000,30
105,TEKU,MANAG,2000,20
106,VENKAT,SSE,4000,10
107,VENKAT,SSE,4000,10
Target1:

Target2:

Target3:
Procedure:

 Drag and Drop the source Metadata tFileInputDelimited component , two tMap and
three tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.

 Double click the tMap Component and Copy the input columns to ouput and add one
new column as NUM_SEQ as per the below.
NUM_SEQ=> Numeric.sequence("s1",1,1)
 Double click the tMap Component and copy the input columns into three output
columns and write the enable /Disable expression filters as per the below
R1 Enable /Disable Filter=> Mathematical.MOD(dd.NUM_SEQ,3)==1(TARGET1)
R2 Enable /Disable Filter=> Mathematical.MOD(dd.NUM_SEQ,3)==2(TARGET2)
R3 Enable /Disable Filter=> Mathematical.MOD(dd.NUM_SEQ,3)==0(TARGET3)
 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

I have One Source File as per the below I want to display country INDIA records
first then remaining records GDP in descending order.
Source:
COUNTRY,GDP
USA,5.6
UK,7.2
INDIA,3.4
AUSTRALIA,8.5
CHINA,9.1
MEXICO,1.2
MEXIC,6.2
Target:

Procedure:

 Drag and Drop the source Metadata tFileInputDelimited component , a tMap, a


tSortRow , two tHashOutput Components,Two tHashInput components ,a TUnite
RowComponent and and three tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.
 Double Click the tMap component Copy the input columns to output and define the
enable/Disable expression filters.

India enable/Disable expression filter=> row1.COUNTRY.equals("INDIA")


Other than India enable/Disable expression filter=> !row1.COUNTRY.equals("INDIA")

 Double click the tSortRow component and Define the Criteria as GDP column as desc
order.
 Double click the tHashOutput1 and copy the schema into tHashinput1 and
tHashOutput2 and copy the schema into tHashinput2 and select the Component list as
for 1 tHashOutput1 and 2 for Thashoutput2.

 Double click the tUnite component and Sync columns .

 Double click the tLogRow components and define the Table (Print Values in cells of a table)
 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

I have One Source File I want to load into two targets based LOC columns.
SROURCE:
SRC_LOC.txt

LOC

HYDERABAD

BANGALORE

CHENNAI

AMERICA

MUMBAI

Target1:

Target2:
Procedure:

 Drag and Drop the source Metadata tFileInputDelimited component , a tFilterRow


and two tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.

 Double click the tFilterRow component and define the condition as per the below.
 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

I have One Source File I want to load into target with based on Company column
and LOC field all values.
Source:
SRC_COMPANY_LOC.txt
COMPANY,LOCATION
IBM,HYD
TCS,BAN
IBM,CHE
HCL,HYD
TCS,CHE
IBM,BAN
HCL,BAN
HCL,CHE
TCS,HYD
Target:

Procedure:
We can do two ways as per the below sub jobs created.

Method1 by using tDenormalize:


 Drag and Drop the source Metadata tFileInputDelimited component , a tDenormalize
and a tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.
 Double click the tDenormalize Component and define the Loc column as to
Denormalize with delimiter “;” .

 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

Method 2 by using tAggregate Row:


 Drag and Drop the source Metadata tFileInputDelimited component , a
tAggregateRow and a tLogRow Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.

 Double click the tAggregateRow component and Group by as COMPANY field and list
function on LOCATION column as per the below.

 Double click the tLogRow components and define the Table (Print Values in cells of a table)
 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

I have two Source Files I want to load into target with based on ID column and
LOC field all values. (MNC company asked this scenario)
Source:
SRC_LOC1.txt
ID,LOC
101,HYD
102,
103,MB
SRC_LOC2.txt
ID,LOC
103,
101,CHE
102,BAN
Target:
Procedure:
 Drag and Drop the source tFileList, Metadata tFileInputDelimited component , a
tBufferOutput ,tBufferInput ,t Denormalize or tAggregateRow and a tLogRow
Components.
 Connect them together by using Row > Main link.
 Double click the tFileList Component and define the Directory

 Double click the First tFileInputDelimited and verify the properties.

 Double click the tBufferOutPut and copy the schema to tBufferInput component.
 Double Click the tDenormalize or tAggregateRow component and define the
properties.
Or

 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

I have two Source Files I want to load into target with based on ID column and
LOC field all values. (MNC company asked this scenario) Other than above
method.
Procedure:
 Drag and Drop the source , two Metadata tFileInputDelimited component , a
tUnite ,tHashOutput ,t HashInput ,tDenormalize or tAggregateRow and a tLogRow
Components.
 Connect them together by using Row > Main link.
 Double click the First tFileInputDelimited and verify the properties.


 Or

 Double click the tLogRow components and define the Table (Print Values in cells of a table)

 Executing the Job or Save your Job and press F6 to execute it.
 You will get the two desired output.

You might also like