So often we come across situation to load data file into Teradata table. Also very frequently we extract data to flat file from Teradata table as well. Occasionally we may have to load data from one Teradata table to another in different servers. The first thing which comes to a developer mind is Teradata PT. However traditionally , developer have been writing lengthy TPT scripts for these activities. To make life simple TPT Easy loader is available for developer which internally calls TPT and creates TPT script dynamically and runs it.
To check if you have tdload client installed on your machine , just type “tdload” and hit enter. If you see options available with TDLOAD it means you can use TPT easy loader.
Basic command is :
tdload -f filename -u username -p password -h tdpid -t tablename
Let’s quickly see an example to see how tdload works. Command to run is:
tdload -f /tmp/sample_data.txt -u dbc -p dbc -h 192.168.100.100 -t td_fix.sample_data -d ‘|’
From image above you can see the data file which is ‘|’ delimited is loaded into table. TDLOAD automatically decides the operator to chose for loading file. Since my Target table was empty , it used “LOAD” operator i.e. FASTLOAD. When I run the same command again without truncating target table I can see “UPDATE” operator i.e. MULTILOAD is used. You can see out of 30000 records in sample file, TPT has loaded some records to ET table too.You can check the table with same name as Target table and add suffix _ET & _UV. Also log table is created with _RL as suffix.
If you have to restart tdload from scratch , make sure to drop _ET,_UV,_RL tables. Also remove corresponding files in “/opt/teradata/client/15.00/tbuild/checkpoint” & “/opt/teradata/client/15.00/tbuild/logs” path. Also recreate your target table.
I am using TD 15, change above path with your version of TPT.