Tools

Batch Write

Write records to multiple tables in a single transaction.

Deprecated: use write_data (client.data.write), which also writes raw series and supports update and delete.

Supports:

  • Batch references: Use "_ref" to label records, "@refname" to reference them
  • Natural keys: Use human-readable values for foreign keys (e.g., recipe name)
  • Automatic FK ordering: Tables are inserted in dependency order
  • Upsert mode: Update existing records based on match columns
  • Dry run: Validate without committing changes

Committed writes are recorded against a job execution (created automatically if not supplied) and the job_execution_id is returned, so the write can be reverted as a unit.

Requires an API key with the write scope.

post/api/v1/tools/batch-write

Request

  • Base URL: https://platform.labric.co
  • URL: https://platform.labric.co/api/v1/tools/batch-write
  • Auth: HTTP bearer

Request body

tablesobject required

Map of table_name to list of records to insert.

Response

OK

successboolean

Whether the operation succeeded.

job_execution_idstring nullable

The job execution this write was recorded under. Use it to revert the write as a unit. Null for dry runs.

summaryobject required

Count of created/updated records per table.

refsobject required

Map of _ref labels to their created IDs.

recordsobject nullable

Created/updated records (only if return_records=True).

Changes

No recorded changes to this operation across all 1 revision of this API.