DynamoDB: batch delete

Excerpt from my program; adapt as needed:


val client = new AmazonDynamoDBClient()
val dynamo = new DynamoDB(client)

val scanRequest = new ScanRequest()

val items = client.scan(scanRequest).getItems
items.grouped(25).foreach(group => {  // DynamoDB: Member must have length less than or equal to 25
  val delItems = new TableWriteItems(LocationRecord.TABLE_NAME)
  group.foreach(item => delItems.addPrimaryKeyToDelete(new PrimaryKey(LocationRecord.FLD_ID, item.get(LocationRecord.FLD_ID).getS)))


see also: http://stackoverflow.com/questions/9154264/what-is-the-recomended-way-to-delete-a-large-number-of-items-from-dynamodb

keywords: aws dynamodb delete all records rows

About Neil Rubens

see http://ActiveIntelligence.org
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *