With the availability of templates, including user-defined templates, there is no reason to define consumer or standalone operators in your job scripts. Use of producer operator templates, however, is potentially limited because the definition of a producer operator requires the specification of an explicit (script-defined) schema as part of the DEFINE OPERATOR syntax.
Standalone operators do not employ schemas and, therefore, do not require a schema specification. Consumer operators specify their schemas as follows:
SCHEMA *
This means that operators accept the schema of whatever data is sent to them in the data streams connecting them to the data sources. But producer operators must identify a script-defined schema that describes the data they place onto the data streams with the syntax phrase
SCHEMA schemaName
where schemaName is the name of a schema defined by a DEFINE SCHEMA statement in your job script. If a producer template actually specified a schema, use of that template would be limited to scripts that included a definition of that particular schema and further limited to occurrences of the template where that schema is the appropriate one.
To overcome this potentially severe restriction on the use of producer operator templates, Teradata PT supports a feature allowing the schema to be specified explicitly or implicitly as part of a producer operator template reference in the APPLY statement, such shown in the following three examples:
... FROM OPERATOR( $FILE_READER( DAILY_SALES ) ) ... ... FROM OPERATOR( $EXPORT( 'Product_Shipments' ) ) ... ... FROM OPERATOR( $FILE_READER( DELIMITED 'Gross_Receipts_YTD' ) ) ...
- In the first example, the execution of the DataConnector producer operator, invoked by this particular reference to its template name $FILE_READER, uses 'DAILY_SALES' as its schema. Such an explicit schema reference can be made only to a schema that was defined earlier in the your job script through a DEFINE SCHEMA statement.
- In the second example, the execution of the Export operator, invoked by this particular reference to its template name $EXPORT, uses a Teradata PT-generated schema based on the column descriptions of the database table Product_Shipments. Such an implicit schema reference can be made only via the name of a database table that already exists at the time your job is submitted.
- In the third example, the execution of the DataConnector producer operator, uses the delimited-file-format version of a Teradata PT-generated schema based on the column descriptions of existing database table Gross_Receipts_YTD.