Special Job Variables for Inferring and Generating a Schema
To generate a schema, either based on a Teradata Database table or based on the results table of an SQL SELECT statement, Teradata PT must first logon to the appropriate Teradata Database to get the column descriptions of the schema to be generated. If the template operator reference itself has logon attribute assignments in its ATTRIBUTES list, then those values will be used for Teradata Database logon. If not, then Teradata PT queries one of two sets of special conventionally-named job variables, either of which, when assigned values, will control Teradata PT's logon to the desired Teradata Database:
When Teradata PT attempts to generate the schema for a producer template, it checks three conditions in order to determine which of the above sets of logon job variables will be queried to provide Teradata Database logon parameters:
1 If the job variable SelectStmt has a value, or if the template reference includes a SelectStmt attribute assignment, then that value, an SQL SELECT statement, from either of these sources will be the basis for the generated schema, and the Source set of logon job variables will be queried to obtain DSB logon parameters.
2 If the job variable SourceTable has a value, then that value, a Teradata Database table name, will be the basis for the generated schema, and the Source set of logon job variables will be queried to obtain DSB logon parameters.
3 If the job variable TargetTable has a value, or if the consumer operators in the job step of producer template collectively identifies one and only one target table, via a TargetTable attribute assignment, then that Teradata Database table will be the basis for the generated schema, and the Target set of logon job variables will be queried to obtain Teradata Database logon parameters.
If the set of logon job variables queried yields logon parameters, and Teradata PT gets the schema column descriptions from the requested Teradata Database, Teradata PT still must determine which schema format to generate: the delimited-file format or the regular column-mapped format. Teradata PT supports one more special job variable that provides this information:
Before generating the DEFINE SCHEMA statement, Teradata PT queries the special job variable SourceFormat. If has the value Delimited, then the generated schema will be in delimited-file format; otherwise, it will be in the normal format in which the schema column definitions closely match the Teradata Database table's column descriptions.