Strategies

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Talend Tutorials & Scenarios Prepared by Venkat Rathnam Tekuri

DELTA_OR_INCREMENTAL_LOAD by using control table.

We have to create 3 tables as per the below


select * from PRODUCT_DETAILS;

Name Null? Type


------------- ----- ------------
PRODUCT_ID NUMBER(38)
PRODUCT_NAME VARCHAR2(50)
PRODUCT_TYPE VARCHAR2(50)
PRODUCT_PRICE NUMBER(38)
CREATED_ON DATE
MODIFIED_ON DATE
SELECT * FROM etl_control;
Name Null? Type
------------ ----- -------------
JOB_ID NUMBER(38)
JOB_NAME VARCHAR2(255)
TABLE_NAME VARCHAR2(255)
LAST_SUCCESS DATE
Target:
select * from TGT_PRODUCT_DETAILS;
Name Null? Type
------------- ----- ------------
PRODUCT_ID NUMBER(38)
PRODUCT_NAME VARCHAR2(50)
PRODUCT_TYPE VARCHAR2(50)
PRODUCT_PRICE NUMBER(38)
CREATED_ON DATE
MODIFIED_ON DATE

Procedure:
 Drag and Drop the below components with Metadata tPreJob,tOracle
Connection,tOracleInput with ETL Control metadata, tJavaRow,
 Create a 2nd Subjob with the following components Source with product_Details
metadata with tOracleInput ,target tgt_product_details and tOracleRow with etl
control table.
 Connect them together by using Row > Main link.
 Double click the tOracleInput with ETL Control define the properties .
 Double click the tJavaRow and define the properties.

// output_row.name = input_row.name.toLowerCase();
context.last_success=TalendDate.formatDate("dd-MM-yyyy",input_row.LAST_SUCCESS);
context.current_run=TalendDate.formatDate("dd-MM-yyyy ",TalendDate.getCurrentDate());
System.out.println("Last Success : " +context.last_success);
System.out.println("Current Run : " +context.current_run);
 Double click the source product_Details metadata with tOracleInput and define the
properties.

"SELECT
SRCVENKAT.PRODUCT_DETAILS.PRODUCT_ID,
SRCVENKAT.PRODUCT_DETAILS.PRODUCT_NAME,
SRCVENKAT.PRODUCT_DETAILS.PRODUCT_TYPE,
SRCVENKAT.PRODUCT_DETAILS.PRODUCT_PRICE,
SRCVENKAT.PRODUCT_DETAILS.CREATED_ON,
SRCVENKAT.PRODUCT_DETAILS.MODIFIED_ON
FROM SRCVENKAT.PRODUCT_DETAILS
where to_char(created_on)>= ' " +context.last_success +
"' or to_char(modified_on)>=' " +context.last_success +" ' "
 Double click the target tgt_product_Details metadata with tOracleOutput and define
the properties.

 Double click the tOracleRow Components define the properties below.

"update ETL_CONTROL set LAST_SUCCESS ='"


+context.current_run +
"' where job_name = '" +jobName+ "
 Save the job and run the job.

You might also like