Parameterize TPT extraction schema columns

Database
Highlighted

Parameterize TPT extraction schema columns

 

Hello,

 

I've similar requirement to parameterize Define schema dynamic in the TPT. Is it possible to pass column list or 

SQLquery(select col1,col2, null col3, sysdate col4 from table) as shown below:

 

Scenario 1: Parameterize Column List:

 

DEFINE JOB UNLOAD_USER_DATA
(DEFINE SCHEMA COLUMN_LIST @Column_list

JobVars Includes:

 

 

,FileWriterFileName = 'myfilename.csv'
,Column_list='(col1 varchar(20), col2 varchar2(10), col3 varchar(10), col4 DATE)'
,Sqlquery ='select col1,col2, null col3, sysdate col4 from table'

 

 

Scenario 2 : Parameterize SQL query to Define Schema:

DEFINE JOB UNLOAD_USER_DATA
(DEFINE SCHEMA COLUMN_LIST FROM SELECT 
@Sqlquery;

 

JobVars Includes:

,FileWriterFileName = 'myfilename.csv'
,Sqlquery ='select col1,col2, null col3, sysdate col4 from table'

 

Please correct me, if my assumptions are wrong. I'm trying to extract data from Teradata and export to file pipe(|) delimiter parameterize filename,columnlist,SqlQuery, DB Credenetials.

 

Advance thanks.

 

thank you.

 
 
2 REPLIES
Teradata Employee

Re: Parameterize TPT extraction schema columns

In many cases, TPT can generate or infer the schema rather than needing to explicitly code it in the script. Take a look at the TPT User Guide, specifically the "Advanced Scripting Strategies" section; also look at the samples in the TPT install directory. It may be as simple as setting the appropriate JobVars and using:

 

APPLY TO OPERATOR ($FILE_WRITER()) SELECT * FROM OPERATOR ($EXPORT());

 

 

 

Re: Parameterize TPT extraction schema columns

Thank you much Fred!