The Export driver’s dynamic schema feature provides the option of having the Export driver dynamically generate the output schema based on the SELECT statement. This feature frees the user application from having to provide a predefined output schema.
Enable this feature by not adding a schema to the Export driver prior to initialization. When the Export driver detects that no user-defined output schema has been added, the Export driver will create an output schema based on the user-provided SELECT statement and the job will continue as normal.
Sharing the Dynamic Schema with Other Drivers
Follow these steps to share the Export driver’s dynamically generated output schema with other drivers:
- Create an instance of the Export driver and add all necessary attributes. Enable the dynamic schema feature by not adding a schema to the Export driver.
- Initialize the Export driver.
- Retrieve the dynamically generated schema from the Export driver through the use of the GetSchema function:
Schema* dynamicSchema; returnValue = exportConnection->GetSchema(&dynamicSchema);
- Pass the dynamically generated schema to the other drivers by using the AddSchema function:
- Initialize the other drivers.
For an example using the dynamic schema feature with a multi-instance Teradata PT API application, see the TPTAPI mnode_dynschema sample application provided with the TPTAPI package. To run a TPTAPI multi-instance application using the dynamic schema feature, the user application must set the TEST_TO_RUN to TEST_EXPORT_TO_LOAD / TEST_EXPORT_TO_STREAM / TEST_EXPORT_TO_UPDATE in master_input.txt and slave_input.txt to run with LOAD / STREAM / UPDATE operators, respectively.