Procedure
Follow these steps to launch a Teradata PT Easy Loader job.
- In a Command window, navigate to the directory where your data file is stored.
- Enter the tdload command at the command prompt.
For example:
tdload -f filename -u username -p password -h tdpid -t tablename
The screen displays the Job Id for the load job.
Example 1: Loading Data from a File to a Teradata Table
tdload -h 8.8.8.8 -u User1 -p Pass1 -f DATA.txt -t MyTable MyJob
The above command will use '8.8.8.8' as the IP address of the machine on which the database is installed, log on to the account 'User1' with the password 'Pass1' and load data from the file DATA.txt into the table 'MyTable'. The job is named "MyJob" for easy logging.
Example 2: Unloading Data from a Teradata Table into a Flat File
tdload --SourceTdpid 8.8.8.8 --SourceUserName User1 --SourceUserPassword Pass1 --SourceTable MyTable --TargetFilename outfile.txt My_Unload_Job
The above command will use '8.8.8.8' as the IP address of the machine on which the database is installed, log on to the account 'User1' with the password 'Pass1', the Unload data from table 'MyTable' into the file 'outfile.txt'. It will also name the job 'My_Unload_Job' for easy Log access
Example 3: Loading Data from one Teradata Table to Another
tdload --SourceTdpid 8.8.8.8 --SourceUserName User1 --SourceUserPassword Pass1 --SourceTable MyOutTable --TargetTdpid 4.4.4.4 --TargetUserName User2 --TargetUserPassword Pass2 --TargetTable MyInTable
The above command will use '8.8.8.8' and '4.4.4.4' as the IP addresses of the machines on which the databases are installed, '8.8.8.8' as the source machine and '4.4.4.4' as the target. Log on to the accounts 'User1' and 'User2' with passwords 'Pass1' and 'Pass2' respectively, then Unload data from table 'MyOutTable' into table 'MyInTable’.
Example 4: Loading Data from a Flat File into a Teradata Table, Choosing the Consumer Operator
tdload -f emp_data.txt -u dbadmin -p pw123 -h tdat1 -t employee -d “|” –-UpdateTraceLevel All
The above command will use ‘tdat1’ as the TdpId of the machine on which the database is installed, log on to the account ‘dbadmin’ with the password 'pw123' and load data from the file emp_data.txt into the table 'employee'. Because we have specified “--UpdateTraceLevel All” as an job variable, tdload will attempt to use the Update operator as the consumer, and resolve all defaults to match it.
Example 5: Loading Data from a Teradata Table into Another Teradata Table
tdload --SourceTdpid OldDataBase --SourceUserName User1 --SourceUserPassword Pass1 --SourceTable MyOutTable --TargetTdpid NewDataBase --TargetUserName User2 --TargetUserPassword Pass2 --TargetTable MyInTable --ExportPrivateLogName ExportLog --LoadTraceLevel All
The above command will use 'OldDataBase' and 'NewDatabase' as the TdpIds of the machines on which the databases are installed, where 'OldDataBase' is the source machine and 'NewDataBase' is the target machine.
Easy Loader will log on to the accounts 'User1' and 'User2' with passwords 'Pass1' and 'Pass2' respectively, then unload data from table 'MyOutTable' into table 'MyInTable’.
Because “--ExportPrivateLogName ExportLog” and “--LoadTraceLevel All” are defined, tdload will attempt to use Export as the producer operator and Load as the consumer operator. This job will fail if the target table does not meet the characteristics required by the Load operator.
Example 6: Using a Job Variable File with tdload
tdload -j my_jvfile My_JVF_Job
with the contents of my_jvfile as:
h = '8.8.8.8', u = 'User1', p = 'Pass1', f = 'DATA.txt', t = 'MyTable', TargetMaxSessions = 8
The above command and job variable file will perform the same operation as example #1, as well as set the consumer operator’s MaxSessions job variable to 8 and name the job 'My_JVF_Job'.
Example 7: Loading Data from a File to a Default Teradata Staging Table
tdload -h 8.8.8.8 -u User1 -p Pass1 -f DATA.txt -t MyTable --DefaultStagingTable MyJob
The above command will use '8.8.8.8' as the IP address of the machine on which the database is installed, log on to the account 'User1' with the password 'Pass1' and load data from the file DATA.txt into the default staging table 'MyTable_STG'. The job is named "MyJob" for easy logging. TPT Easy Loader will create the staging table
.Example 8: Loading Data from a File to a User-specified Teradata Staging Table
tdload -h 8.8.8.8 -u User1 -p Pass1 -f DATA.txt -t MyTable --StagingTable MyStagingTable MyJob
The above command will use '8.8.8.8' as the IP address of the machine on which the database is installed, log on to the account 'User1' with the password 'Pass1', and load data from the file DATA.txt into the staging table 'MyStagingTable'. The job is named "MyJob" for easy logging. TPT Easy Loader will create the staging table.
Sample Flat File
The following shows the contents of a flat file with data in delimited format. The delimiter character is the pipe(''|''). Teradata PT Easy Loader can only load a delimited format flat file.
The schema of this file matches the schema of the Teradata Employee table used in the other Teradata PT job examples.
10001|John Smith|93000.00|1954-10-21|Sr. Software Engineer|100|Y|5 10002|Mary Knotts|45000.00|1974-09-13|Secretary|100|Y|1 10005|Keith Muller|85000.00|1972-06-09|Sr. Software Engineer|100|Y|3 10021|David Crane|65000.00|1966-10-02|Technical Writer|101|Y|2 10022|Richard Dublin|60000.00|1965-03-19|Software Engineer|100|N|0 10023|Kelly 0'Toole|65000.00|1955-04-08|Software Tester|102|N|2 10024|Brett Jackson|75000.00|1962-04-08|Software Engineer|100|Y|2 10025|Erik Wickman|79000.00|1965-03-08|Software Engineer|100|N|2