Sample TPT script for Exporting

Applications
Applications covers the world of Teradata apps, including apps offered by Teradata (such as TRM or DCM), as well as best practices and methodologies for building your own Teradata-connected apps.
Enthusiast

Sample TPT script for Exporting

Hi,

 

Could you please provide a sample TPT script for exporting data from multiple tables to multiple files.

 

eg. to export from below 2 tables to below mentione 2 files.

TAB1

TAB2

 

FILE1

FILE2

4 REPLIES
Senior Supporter

Re: Sample TPT script for Exporting

Did you checked the examples for a single table export?

Like /opt/teradata/client/YOURVERSION/tbuild/sample/userguide/PTS00016

DEFINE JOB EXPORT_DELIMITED_FILE
DESCRIPTION 'Export rows from a Teradata table to a delimited file'
(

  DEFINE SCHEMA PTS00016_SCHEMA 
  (

       Associate_Id     INTEGER,
       Associate_Name   CHAR(25),
       Salary           FLOAT,
       DOJ              INT,
       Designation      VARCHAR(25),
       Loan_Amount      DECIMAL(5,2),
       Martial_Status   CHAR(1),
       No_Of_Dependents BYTEINT
  );

  APPLY TO OPERATOR ($FILE_WRITER()[@WriterInstances] ATTR (FileName = 'accounts4.txt') )
  SELECT * FROM OPERATOR ($EXPORT(PTS00016_SCHEMA)[@SelectorInstances] ATTR ( 

      SelectStmt             = 'select * from PTS00016_SRC;'
   )


  ); 
);

I would replicate the schema and the apply section for a second export.

If this doesn't work share your code...

Apprentice

Re: Sample TPT script for Exporting

...and if you're working in a Windows environment the equivalent sample code file is typically at:

 

"C:\Program Files (x86)\Teradata\Client\YOURVERSION\Teradata Parallel Transporter\sample\userguide\PTS00016"

or

"C:\Program Files\Teradata\Client\YOURVERSION\Teradata Parallel Transporter\sample\userguide\PTS00016"

 

Cheers,

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com
Enthusiast

Re: Sample TPT script for Exporting

 

Thanks ulrich & dave for the sample code and details.

 

I have to write TPT job in mainframe and send file to a windows location so using TPT can we also mention the path where we have to send the file.

 

Apprentice

Re: Sample TPT script for Exporting

Hi,

I'm not sure you can do this directly from TPT on a mainframe.

(Ignoring TPT for now) How do you get files from your mainframe to a Windows environment? Possibly your best bet is to use that mechanism.

In which case, your TPT job simply writes a mainframe file.

Then use 'the mechanism' as a separate job step to transfer the file to Windows.

Cheers,

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com