Loading extract using Teradata Multiload
Goal
Load customer extract file using FTP command line script and Teradata MultiLoad tool.
The ftp command line tool will fetch the extract from a source system into an ETL server.
The MultiLoad Job Script will load the script into a Teradata database.
FTP script
An FTP command line script will be used to get the extract file. The get_cust_extract.txt control script has the following
contents:
open 10.150.193.128 etltoolsinfouser dwpwd1 prompt lcd /dw/input/Dwh_cust_extract.txt mget Dwh_cust_extract*.txt quit
Invoke FTP commands in command prompt (Windows or Unix) by issuing the following command: ftp -s:get_cust_extract.txt
Teradata MultiLoad (Mload)
The goal is to create a Teradata MultiLoad job script to import data into an empty table and select data from the table to verify the import task.
MultiLoad is a Teradata utility with a purpose to do fast, high-volume loading on multiple tables and views of a Teradata RDBMS.
MultiLoad processes a series of MultiLoad commands and Teradata SQL statements as a batch job script which are used for session control and data transfers.
Among others, the MultiLoad script will use the following statements to load the data:
.LOGTABLE dwlogtable; .LOGON tdp1/etltoolsinfo,dwpwd1; .begin import mload tables customers; .layout custlayout; .field ID 1 INTEGER; .field CUST_ID * VARCHAR(6); .field CUST_NAME * VARCHAR(30); .field CUST_GROUP * VARCHAR(30); .field CUST_SEGMENT * VARCHAR(10); .field CUST_COUNTRY_ID * VARCHAR(3); .dml label custdml; insert into customers.*; .import infile /dw/input/Dwh_cust_extract.txt format VARtext ';' layout custlayout apply custdml; .end mload; .logoff;To load the extract, the following mload statement needs to be issued:
mload < load_cust_extract.mload
And the following Teradata BTEQ script is invoked (Basic Teradata Query) to verify the MultiLoad loading process:
bteq .logon tdp1/etltoolsinfo,dwpwd1; select count(1) CustCnt from customers; .quit
*** Query completed. 1 row found. 1 columns returned.
*** Total elapsed time was 1 seconds.
CustCnt
-----
22
As a result, all the customers records are loaded into the data warehouse.
Read more about Teradata loading at: