Using the Export Driver’s Dynamic Schema Feature
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:
1 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.
2 Initialize the Export driver.
3 Retrieve the dynamically generated schema from the Export driver through the use of the GetSchema function:
returnValue = exportConnection‑>GetSchema(&dynamicSchema);
4 Pass the dynamically generated schema to the other drivers by using the AddSchema function:
5 Initialize the other drivers.
Note: The Export driver’s dynamic schema feature is also available with multiple instance Export jobs.
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.