Teradata Normalized Transformation

download Teradata Normalized Transformation

of 39

  • date post

    14-Apr-2018
  • Category

    Documents

  • view

    217
  • download

    0

Embed Size (px)

Transcript of Teradata Normalized Transformation

  • 7/30/2019 Teradata Normalized Transformation

    1/39

    Teradata 13.0Normalization 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 haveprepared a complete end-to end Hands-on Guide for building

    financial data model in Teradata. The document focuses on howthe real world requirement should be interpreted. Thedocument focuses on converting the transaction model to OLAPmodel. Join our professional training program and learn fromexperts.

    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

  • 7/30/2019 Teradata Normalized Transformation

    2/39

    Contents

    Contents.......................................................................................................................... 2

    Source Data Model ..........................................................................................................3

    Target Data Model...........................................................................................................3

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

  • 7/30/2019 Teradata Normalized Transformation

    3/39

    Summary: In the below, we are going to convert the transitional model withmultiple tables spread across with one subject area. i/e supplier has Suppliers,

    Suppier_Type etc. As part of normalization transformation it, the below source data

    mode will be de-normalized to start schema.

    Source Data Model

    Target Data Model

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

  • 7/30/2019 Teradata Normalized Transformation

    4/39

    Customer Source Model and Mapping Sheet

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

  • 7/30/2019 Teradata Normalized Transformation

    5/39

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

  • 7/30/2019 Teradata Normalized Transformation

    6/39

    Supplier Source Model and Mapping Sheet

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

  • 7/30/2019 Teradata Normalized Transformation

    7/39

    Product Source Model and Mapping Sheet

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

  • 7/30/2019 Teradata Normalized Transformation

    8/39

    Employee Source Model and Mapping Sheet

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

  • 7/30/2019 Teradata Normalized Transformation

    9/39

    Store Source Model and Mapping Sheet

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

  • 7/30/2019 Teradata Normalized Transformation

    10/39

    Normalize Transformation Using Fast Load UtilityDIM_CUSTOMER:-

    Step #1:-First we perform the load operation from multiple tables to single target

    table with the help of fast load utility. All the multiple table is normalize table which has

    placed in single database and then we create the denormalize table with the help of

    normalize table in other database.

    Step #2:- First we use the fast export utility because this utility help for searching the

    data from source tables.

    1.) BEGIN EXPORT STATEMENT.

    2.) DEFINE THE OUTPUT FILE NAME.

    3.) THE SELECT PULLS DATA FROM TABLE

    (REGION,TERRITORIES,CUSTOMER_TYPE,CUSTOMER).

    4.) END THE JOB AND LOGOFF TERADATA.

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

    /* ---------------------------------------------------------------*/ ALWAYS GOOD TO IDENTIFY THE

    /* @(#) FASTEXPORT SCRIPT */ SCRIPT AND AUTHOR IN/* @(#) Version 1.1 */ COMMENTS/* @(#) Created by BISP Team *//* ---------------------------------------------------------------*/

  • 7/30/2019 Teradata Normalized Transformation

    11/39

    Step #3:- Now the we execute this fast export script in command prompt. After

    successful execution it will generate the output log file and system generated data file

    or output data file.

    Step #4:- Now the fast export script has successfully executed and it has generated

    output log file and system generated output data file.

    Step #5:- Now we create the fast load flat file script because fast load utility help forloading the data into the target table. We use the system generated output data file for

    loading purpose in empty target table.

    1.) LOGIN ONTO TERADATA.

    2.) DEFINING INPUT DATA FILE

    3.) DEFINING THE ERROR FILES

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

  • 7/30/2019 Teradata Normalized Transformation

    12/39

    4.) FAST LOAD PERFORM END LOADING.

    5.) DEFINE LOGOFF CONNECTION

    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 err2_cust and UV_cust

    table. First error table (err2_cust) contains only constraints based related error and

    second error table (UV_cust) contains only unique violation error.

    4.) FAST LOAD PERFORM END LOADING:- The target table must be empty at theloading 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 #6:- Now we execute this fast load flat file script in command prompt. It will takefew second for successful execution.

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

    /* ++++++++++++++++++++++++++++ */ Always good to identify the/* FASTLOAD SCRIPT TO LOAD THE */ script and author in comment.

    /* OLTP.CUSTOMER,CUSTOMER_TYPE,REGION, *//* TERRITORIES TABLE Version 1.1 */

    /* Created by BISP Team */

    /* ++++++++++++++++++++++++++++ */

  • 7/30/2019 Teradata Normalized Transformation

    13/39

    Step #7:- This fast load script has successfully executed in command prompt. After

    the execution fast load generated the output log file.

    Step #8:- Now we show the output log file of fast load utility. This output log file

    generated with three phase's, which is following-

    1.) Logon/connection

    2.) Insert Phase

    3.) End Loading Phase

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

  • 7/30/2019 Teradata Normalized Transformation

    14/39

    1.)DEFINING LOGON CONNECTION:- In this logon statement, we have successfully

    created the logon connection of fast load utility.

    2.)INSERT PHASE:- In this insert phase, we have performed the DML operation i.e.

    insert operation. In this insert operation, we are sending all 3 records from system

    generated output data file (fexp_tp_data.txt) to target table i.e. TRG_CREDIT table.

    3.)END LOADING PHASE:- In this END LOADING PHASE, we have completed the

    loading process into the target table. System has read total 3 records from output data

    file and now applied the insert operation in all 3 records. There is no error in error table

    1 and error table 2. We can manually drop both the error table from the database,

    where the error table place and we are not loading any duplicate rows then total

    duplicate rows is zero.

    Step #9:- Now we show the target table and that target table has successfully loaded

    with the help of fast load utility. This target table is denormalize table and it has

    loaded. We can check the target table with the help of following sql query-

    SELECT * FROM OLAP.DIM_CUSTOMER;

    This sql query help for loading the data into target table.

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

  • 7/30/2019 Teradata Normalized Transformation

    15/39

    DIM_SUPPLIER

    Step #10:-First we perform the load operation from multiple source tables to single

    target table with the help of fast load utility. All the multiple source table is normalize

    table which has placed in different database and after that we create the denormalize

    table with the help of normalize table and that denormalize table place in different

    database.

    Step #11:- Now we use the fast export utility because this utility help for searching

    the data from source tables. We create the fast export script. This script help for

    searching the data.

    1.) BEGIN EXPORT STATEMENT.

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

  • 7/30/2019 Teradata Normalized Transformation

    16/39

    2.)