Import Scenario - Access Module

Teradata Tools and Utilities Access Modules User Guide

Product
Access Module
Release Number
15.10
Language
English (United States)
Last Update
2018-06-06
Product Category
Teradata Tools and Utilities

Import Scenario

Job Variable File

Note: The parameters inside <> brackets need to be replaced appropriately and <> brackets need to be removed.

/********************************************************/
/* TPT attributes - Common for all Samples              */
/********************************************************/
TargetTdpId = '<Teradata Database ID>'
,TargetUserName = '<TargetUserName>'
,TargetUserPassword = '<TargetUserPassword>'
,TargetErrorList = [ '3706','3803','3807' ]
,DDLPrivateLogName = 'DDL_OPERATOR_LOG'
 
/********************************************************/
/* TPT LOAD Operator attributes                         */
/********************************************************/
 
,LoadPrivateLogName = 'LOAD_OPERATOR_LOG'
,LoadTargetTable = 'S3W001'
,LoadLogTable = 'S3W001_log'
,LoadErrorTable1 = 'S3W001_e1'
,LoadErrorTable2 = 'S3W001_e2'
 
/********************************************************/
/* TPT DataConnector Producer Operator                  */
/********************************************************/
 
,FileReaderFormat = 'Formatted'
,FileReaderPrivateLogName = 'S3W001P2_1'
,FileReaderFileName = 'S3W001DT'
,FileReaderDirectoryPath = '.'
,FileReaderOpenMode = 'Read'
 
/********************************************************/
/* APPLY STATEMENT parameters                           */
/********************************************************/
,LoadInstances = 1
,FileReaderInstances = 1

Setup Job

DEFINE JOB IMPORT_TO_TERADATA_SETUP
DESCRIPTION 'Import data to Teradata from Amazon S3'
(
    STEP CLEANUP_CREATE_TABLE_STEP
    (
        APPLY
        (' DROP TABLE S3W001 '),
        (' DROP TABLE S3W001_e1 '),
        (' DROP TABLE S3W001_e2 '),
        (' DROP TABLE S3W001_log '),
        ('CT S3W001
          (
              Associate_Id INTEGER,
              Associate_Name CHAR(25),
              Salary FLOAT,
              DOJ DATE,
              Designation VARCHAR(25),
              Loan_Amount DECIMAL(5,2),
              Martial_Status CHAR(1),
              No_Of_Dependents BYTEINT
          );
        ')
        TO OPERATOR ($DDL);
    );
);

Import Job

Note: The parameters inside <> brackets need to be replaced appropriately and <> brackets need to be removed. Teradata Access Module for Amazon S3 config and credentials files need to be created and placed at $HOME/.aws.

(
 
    SET TargetTable = 'S3W001';
 
    STEP IMPORT_THE_DATA
    (
        APPLY $INSERT TO OPERATOR ($LOAD)
        SELECT * FROM OPERATOR ($FILE_READER ()
            ATTR
            (
                AccessModuleName = 'libs3axsmod.so',
                AccessModuleInitStr = 'S3Bucket=<S3BucketName> S3Prefix="<PrefixName>/" S3Object=testdata.raw S3SinglePartFile=True'
            )
        );
 
    );
);