Teradata Router Transformation

12
Teradata 13.0 Router Transformation using Fast load Utility Description: BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Guide for building financial data model in Teradata. The document focuses on how the real world requirement should be interpreted. The mapping document template with very simplified steps and screen shots makes the complete learning so easy. The document focuses on hands-on practice for router transformation using Fast Load Utility. Join our professional training program and learn from experts. History: Version Description Change Author Publish Date 0.1 Initial Draft Anil Tekam 12th Aug 2011 0.1 Review#1 Amit Sharma 18 th Aug 2011 www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 1

description

BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Guide for building financial data model in Teradata. The document focuses on how the real world requirement should be interpreted. The mapping document template with very simplified steps and screen shots makes the complete learning so easy. The document focuses on hands-on practice for router transformation using Fast Load Utility. Join our professional training program and learn from experts.

Transcript of Teradata Router Transformation

Page 1: Teradata Router Transformation

Teradata 13.0Router Transformation using Fast load Utility

Description: BISP is committed to provide BEST learning material to the beginners and advance learners. In the same series, we have prepared a complete end-to end Hands-on Guide for building financial data model in Teradata. The document focuses on how the real world requirement should be interpreted. The mapping document template with very simplified steps and screen shots makes the complete learning so easy. The document focuses on hands-on practice for router transformation using Fast Load Utility. Join our professional training program and learn from experts.

History:Version Description Change Author Publish Date0.1 Initial Draft Anil Tekam 12th Aug 20110.1 Review#1 Amit Sharma 18th Aug 2011

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 1

Page 2: Teradata Router Transformation

ContentsContents.......................................................................................................................... 2

Introduction .................................................................................................................... 3

Summary......................................................................................................................3

Mapping sheet of Source to Target table......................................................................3

Steps to Perform Router Transformation using Fast load utility...................................3

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 2

Page 3: Teradata Router Transformation

Introduction This is one of our documents for router transformation using the fast export utility and fast load utility.

Summary In this operation, we load the source table data into the different target tables exist in different databases. We have performed the router transformation for loading the source data into different target tables. In this task we have used the fast export utility, with the help of this fast export utility we filter the data from source and that data load in different target tables. For loading the data, we use fast load utility. This utility is use for loading the data into different target tables (which has placed in different database's).

Mapping sheet of Source to Target table Source database name is Financial. There is two different database's i.e. OLAP database and OLTP database.

Steps to Perform Router Transformation using Fast load utility

Step #1:-The source data is given below. In this source table data, we apply the fast export utility for filtering that data and storing it into different target tables.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 3

Page 4: Teradata Router Transformation

Target Table 1:- This is our first target table (TRG_ACCOUNT_OFFICER_1) and this target table is part of OLAP database. Target table structure is same as the source table structure.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 4

Page 5: Teradata Router Transformation

Target Table 2:- This is our another target table(TRG_ACCOUNT_OFFICER_2) and this table is part of OLTP database. This target table structure is same as source table structure.

Step #2:-Now we create the fast export flat file script. Fast export is as given below.1.) BEGIN EXPORT STATEMENT. SESSIONS 2;2.) DEFINE THE OUTPUT FILE NAME.3.) THE SELECT PULLS DATA FROM TABLE (Financial.SRC_ACCOUNT_OFFICER_CD).4.) END THE JOB AND LOGOFF TERADATA.

Step #3:-Now we execute this fast export flat file script in command prompt. we have written the command of fast export utility.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 5

/* ---------------------------------------------------------------*/ ALWAYS GOOD TO IDENTIFY THE /* @(#) FASTEXPORT SCRIPT */ SCRIPT AND AUTHOR IN/* @(#) Version 1.1 */ COMMENTS/* @(#) Created by BISP Team *//* ---------------------------------------------------------------*/

Page 6: Teradata Router Transformation

Step #4:-Now fast export script has successfully executed and it has generated output log file (fexp_router_log.txt) and two output data file, one is fexp_rt_1.txt file and second is fexp_rt_2.txt file. param_data.txt is another flat file and this file hold some conditional data.

Step #5:-Now we create the first fast load flat file script. This fast load script help for loading the data into target table.1.) LOGIN ONTO TERADATA.2.) DEFINING INPUT DATA FILE3.) DEFINING THE ERROR FILES4.) FAST LOAD PERFORM END LOADING.5.) DEFINE LOGOFF CONNECTION

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 6

/* ++++++++++++++++++++++++++++*/ Always good to identify the /* FASTLOAD SCRIPT TO LOAD THE */ script and author in comment. /* OLAP.TRG_ACCOUNT_OFFICER_1 TABLE *//* Version 1.1 *//* Created by BISP Team *//* ++++++++++++++++++++++++++++*/

Page 7: Teradata Router Transformation

1.) LOGIN ONTO TERADATA:- we logon into the teradata fast load utility.2.) DEFINING INPUT DATA FILE:- Now we comes the DEFINE statement. Fast load must know the structure and the name of the flat file to be used as the input flat file or source file for loading the data.3.) DEFINING THE ERROR FILES:- In this script, there is no create table statement for the error tables. This error files work as error table. Fast load automatically generate both error table. In this instance, they are named emp1_sal and UV_sal table. First error table (emp1_sal) contains only constraints based related error and second error table (UV_sal) contains only unique violation error.4.) FAST LOAD PERFORM END LOADING:- The target table must be empty at the loading time and if the loading has completed, then we use the END LOADING statement. If we don't use the END LOADING statement then we get error i.e. Target table being loaded and that time we can't access the loading data.5.) DEFINE LOGOFF CONNECTION:- Now all the sessions has logoff. This is the last statement of this fast load script. Now the table lock has released and if no rows in the error table, then that error table automatically dropped and if there is any single row in error table then we check it, then we take appropriate action and drop that error table manually.

Step #7:-Now we execute this fast load flat file script in command prompt. After the successful execution of this fast load utility, it will generate the output log file

Step #8:- Now we create the second fast load flat file script . This fast load script help of loading the data into different target table which is store in different database.

1.) LOGIN ONTO TERADATA.2.) DEFINING INPUT DATA FILE3.) DEFINING THE ERROR FILES4.) FAST LOAD PERFORM END LOADING.5.) DEFINE LOGOFF CONNECTION

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 7

/* ++++++++++++++++++++++++++++*/ Always good to identify the /* FASTLOAD SCRIPT TO LOAD THE */ script and author in comment. /* OLTP.TRG_ACCOUNT_OFFICER_2 TABLE *//* Version 1.1 *//* Created by BISP Team *//* ++++++++++++++++++++++++++++*/

Page 8: Teradata Router Transformation

1.) LOGIN ONTO TERADATA:- we logon into the teradata fast load utility.2.) DEFINING INPUT DATA FILE:- Now we comes the DEFINE statement. Fast load must know the structure and the name of the flat file to be used as the input flat file or source file for loading the data.3.) DEFINING THE ERROR FILES:- In this script, there is no create table statement for the error tables. This error files work as error table. Fast load automatically generate both error table. In this instance, they are named emp1_sal and UV_sal table. First error table (emp1_sal) contains only constraints based related error and second error table (UV_sal) contains only unique violation error.4.) FAST LOAD PERFORM END LOADING:- The target table must be empty at the loading time and if the loading has completed, then we use the END LOADING statement. If we don't use the END LOADING statement then we get error i.e. Target table being loaded and that time we can't access the data.5.) DEFINE LOGOFF CONNECTION:- Now all the sessions has logoff of this fast load utility. This is the last statement of this fast load script. Now the table lock has released and if no rows in the error table, then that error table automatically dropped and if there is any row or single row in error table then we check it, then we take appropriate action and drop that error table manually.Step #9:-Now we execution this fast load flat file script (fload_router.txt) in command prompt. After the successful execution it will generate the fload_router_log.txt file.

Step #10:-Both fast load flat file script has successfully executed and both fast load script has generated output log files.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 8

Page 9: Teradata Router Transformation

Step #11:-Now we show the output log file script of fload_rtd.txt file. It has generated two phase's, which are as follow-1.) Insert Phase.2.) End Loading Phase.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 9

Page 10: Teradata Router Transformation

1.) Insert Phase:- In this insert phase, we perform the insert operation. We are sending 8 rows from output data file to target table. Now sending the rows into the target table has completed.2.) End Loading Phase:- In this End Loading Phase, we have completed the loading operation into the target table. In target table, we have read total 8 records and insert operation has applied in all 8 records.

Step #12:-Now we show the output log file script of fload_router.txt file. It has generated two phase's after the execution.

1.) Insert Phase2.) End Loading Phase

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 10

Page 11: Teradata Router Transformation

1.) Insert Phase:- In this phase, We are sending 14 records from output data file (fexp_rt_2.txt). Total 14 records has send into the target table.2.) End Loading Phase:- In this phase, loading process has completed. Now total 14 records read from target table and insert operation applied all 14 records. There is no error in error table that's why both error tables has dropped.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 11

Page 12: Teradata Router Transformation

Step #13:-Now show the result of fast load first target table i.e. TRG_ACCOUNT_OFFICER_1 table. In this fast load utility, the data of output data file(fexp_rt_1.txt) has successfully loaded into target table and we have loaded only those data which account balance is greater than 3000 . This target table placed in different database i.e. OLAP database.Target Table 1.) Target table is TRG_ACCOUNT_OFFICER_1 and database is OLAP.

Target Table 2.) In this second target table, we load only those data which account balance is less than 3000 and this data exist in another output data file and this output data file has successfully loaded into second target table (TRG_ACCOUNT_OFFICER_2) With the help of fast load utility. Our second Target table is TRG_ACCOUNT_OFFICER_2 and database is OLTP.

www.bispsolutions.com | www.hyperionguru.com | www.bisptrainings.com | Page 12