DDButil
Helper functions for batch operations in AWS DynamoDB with DocumentClient
interface:
- run
query
/scan
operations without worrying aboutExclusiveStartKey
- run
batchPut
/batchDelete
(which usebatchWrite
operation internally) without worrying aboutUnprocessedItems
- utilise forwarding functions that call
.promise()
on docClient function results, so you don't have to
Installation
npm install ddbutil
Usage
query example
const docClient = ; const queryParams = TableName: 'Table_A' Select: 'SPECIFIC_ATTRIBUTES' ProjectionExpression: 'Attr1, Attr2' KeyConditionExpression: 'Attr1 = :Attr1' ExpressionAttributeValues: ':Attr1': '123' ReturnConsumedCapacity: 'TOTAL' ; ddbutil ;
batchPut example
const docClient = ; const writeParams = ReturnConsumedCapacity: 'TOTAL' ; const items = Attr1: '123' Attr2: 'aaa' Attr1: '123' Attr2: 'bbb' Attr1: '123' Attr2: 'ccc' ; ddbutil ;