21 The Salesforce Driver : Using DataDirect Bulk Load With the Salesforce Driver

Using DataDirect Bulk Load With the Salesforce Driver
The driver supports DataDirect bulk load. Bulk load connection options are located on the Bulk tab of the driver Setup dialog box. The driver sends data to a Salesforce instance using the Salesforce Bulk API instead of the Web Service API. Using the Bulk API significantly reduces the number of Web service calls the driver uses to transfer data and may improve performance.
See “Using DataDirect Bulk Load” for a general description of DataDirect bulk load and its implementation.
Bulk Operation Support
The Salesforce driver supports additional bulk operations besides bulk Insert when loading a data from an input file.
Features include:
Bulk Delete - The input file contains only a list of values for a Salesforce primary key column. The driver uses the bulk protocol to delete the rows corresponding to the key values.
Bulk Update - The input file contains a list of values for a Salesforce primary key column (required) and columns for which the data should be updated. The driver uses the bulk protocol to update the columns based on the rows that match the primary key values.
Bulk Upsert - The input file contains a list of values for a Salesforce External Id column (required) and column values for which the data should be updated if the external id value already exists or inserted to the table if the external id value does not exist.
Refer to Chapter 9 “DataDirect Bulk Load” in the DataDirect Connect Series for ODBC Reference for details.
Using Column Mapping
The Salesforce driver can use the DataDirect functions LoadTableFromFile (for an ANSI application) and LoadTablefromFileW (for a Unicode application) to support mapping of the column names defined in the input file to columns defined in the Salesforce table.
To take advantage of this feature, create a list of columns that are not auto-generated by Salesforce and specify a string argument of the format:
TableName(ColumnName[,ColumnName[,ColumnName]...])
for the TableName parameter of the LoadTableFromFile(W) function.
By default, the driver requires a one-to-one mapping of the columns defined in the input file to the columns defined in the Salesforce table. Because Salesforce tables contain several auto-generated key columns, it is not possible to achieve the required one-to-one mapping. Use only columns that were not auto-generated in the column list for which the data file defines the data that you want to load.
Refer to Chapter 9 “DataDirect Bulk Load” in the DataDirect Connect Series for ODBC Reference for details.
Using Bulk Load for Single Inserts/Updates/Deletes
You can configure the driver to use the bulk load protocol when it encounters a request to execute a single Insert, Update, or Delete statement that affects many rows. When the EnableBulkLoad connection option is set to true, the Salesforce driver uses the Salesforce Bulk API for single Insert, Update, and Delete statements if the number of rows affected by the operation exceeds the threshold set by the BulkLoadThreshold connection option.
For example, if you set the EnableBulkLoad connection option to true and the BulkLoadThreshold connection option to 2000, executing the following statement would use the Bulk API if the number of rows returned by SELECT rowid, sys_name FROM account is more than 2000 rows.
INSERT INTO tmpAccounts(accountId, accountName)
SELECT rowid, sys_name FROM account