Row by Row Loading into the Teradata Database - Parallel Transporter

Teradata® Parallel Transporter Application Programming Interface Programmer Guide

Product
Parallel Transporter
Release Number
16.20
Published
November 2020
Language
English (United States)
Last Update
2020-11-19
dita:mapPath
ghk1527114222323.ditamap
dita:ditavalPath
Audience_PDF_include.ditaval
dita:id
B035-2516
lifecycle
previous
Product Category
Teradata Tools and Utilities

There are three parts to loading data into the Teradata Database using Teradata PT:

  • Load rows
  • Inform Teradata PT that acquisition is complete
  • Apply rows to the Teradata Database

Data is loaded using the Connection object’s PutRow function. The PutRow function accepts as its arguments a pointer to a single row of data in null-indicator mode format, and the length of the data row (including the length of the null-indicator bytes). See Data Format for an illustration of the indicator-mode input data format.

The PutRow length is the total length of all the column values (including the length bytes for variable-length values) plus the number of indicator bytes. See Data Format for information on how to determine the number of indicator bytes in a row.

while (!endOfData) {
/* Assemble a row in null-indicator format */
   ...
/* Pass a row to the Teradata Database */
 conn->PutRow(buffer, length);
}

Although the application passes a row at a time, the Load, Update, and Stream drivers accumulate the rows in the CLIv2 buffer and then send them to the DBS by the buffer load.

Once all data has been loaded, the acquisition method is completed by calling the Connection object’s EndAcquisition function. This must be done before the data can be applied.

conn->EndAcquisition( );

When the acquisition method has been completed, the data is applied in the Teradata Database by using the Connection object’s ApplyRows method. This method should only be called when using the Load or Update driver. The Stream driver automatically applies the changes which means the ApplyRows method should not be called when using the Stream driver.

conn->ApplyRows( );