Bulk Write Rows

Catalyst enables you to perform bulk write jobs on a specific table present in the Data Store. The bulk write operation can fetch thousands of records from a CSV file uploaded in the File Store and insert them in a specific table.

The table is referred to by its unique Table ID. The column in which the write operation must be performed is referred to by its unique column ID.

Note: To perform a bulk write operation, you must first upload the required data as a CSV file in the File Store. During the write job, the file will be referred to by its unique file ID that will be generated by Catalyst once the file is uploaded.

Catalyst supports the following methods for bulk write in Java SDK:

Method Used Description
createBulkWriteJob(bulkWriteDetails) Create a new bulk write job on a specific table.
createInsertBulkWriteJob(table ID, file ID) Create a new bulk write insert job.
createUpsertBulkWriteJob(tableId, file ID, column ID) Create a new bulk write upsert job.
getBulkWriteJobDetails(jobID) Get the status and results of a bulk write job.

Copy the SDK snippet below to perform a bulk write job on a particular table.

Ensure the following packages are imported:

import com.zc.component.object.bulk.ZCBulkWriteServices; import com.zc.component.object.bulk.ZCDataStoreBulk; import com.zc.component.object.bulk.result.ZCBulkResult; import com.zc.component.object.bulk.ZCBulkWriteDetails
ZCBulkWriteServices bulkWrite = ZCDataStoreBulk.getInstance().getBulkWriteInstance(); // create bulk write instance ZCBulkWriteDetails bulkWriteDetails = ZCBulkWriteDetails.getInstance(); // create and fill the bulk write details object bulkWriteDetails.setTableIdentifier(12096000000642178L); // Provide your Table ID bulkWriteDetails.setFileId(file ID); ZCBulkResult bulkWriteResult = bulkWrite.createBulkWriteJob(bulkWriteDetails); // create bulk write job bulkWrite.createInsertBulkWriteJob(12096000000642178L, file ID); // Provide your Table ID // create bulk write insert job bulkWrite.createUpdateBulkWriteJob(12096000000642178L, file ID, 12096000000642900L); // Provide your Table ID and Column ID // create bulk write insert job bulkWrite.createUpsertBulkWriteJob(12096000000642178L, file ID, 12096000000642900L); // Provide your Table ID and Column ID // create bulk write upsert job bulkWrite.getBulkWriteJobStatus(bulkWriteResult.getJobId()); // get the bulk write job status and results

Note: A maximum of 100,000 rows can be written simultaneously using the createBulkWriteJob() method.

Last Updated 2023-12-14 16:25:23 +0530 +0530



Data Store