TableBatchWrite
Table-level command to perform a batch write across multiple entity types.
Unlike BatchWrite which operates on a single entity type, this command accepts
write operations from multiple entities via entity.prepare(new BatchWrite({ ... }))
and executes them in a single DynamoDB BatchWrite request.
Unprocessed puts and deletes are returned per entity in a tuple matching the input order.
Example
Section titled “Example”const { unprocessedPuts, unprocessedDeletes } = await table.send(new TableBatchWrite({ writes: [ userEntity.prepare(new BatchWrite({ items: [{ userId: 'u1', name: 'Alice' }], deletes: [{ userId: 'u2', name: 'Bob' }], })), orderEntity.prepare(new BatchWrite({ items: [{ orderId: 'o1', status: 'pending', total: 99 }], })), ],}))
const [userUnprocessedPuts, orderUnprocessedPuts] = unprocessedPutsconst [userUnprocessedDeletes, orderUnprocessedDeletes] = unprocessedDeletesType Parameters
Section titled “Type Parameters”Writes
Section titled “Writes”Writes extends PreparedBatchWrite<any>[]
Implements
Section titled “Implements”TableCommand<TableBatchWriteResult<Writes>>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new TableBatchWrite<Writes>(config): TableBatchWrite<Writes>;Parameters
Section titled “Parameters”config
Section titled “config”TableBatchWriteConfig<Writes>
Returns
Section titled “Returns”TableBatchWrite<Writes>
Methods
Section titled “Methods”execute()
Section titled “execute()”execute(table): Promise<TableBatchWriteResult<Writes>>;Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<TableBatchWriteResult<Writes>>