I\'m writing a simple logging service in DynamoDB.
I have a logs table that is keyed by a user_id hash and a timestamp (Unix epoch int) range.
When a user of
My approach to delete all rows from a table i DynamoDb is just to pull all rows out from the table, using DynamoDbs ScanAsync and then feed the result list to DynamoDbs AddDeleteItems. Below code in C# works fine for me.
public async Task DeleteAllReadModelEntitiesInTable()
{
List readModels;
var conditions = new List();
readModels = await _context.ScanAsync(conditions).GetRemainingAsync();
var batchWork = _context.CreateBatchWrite();
batchWork.AddDeleteItems(readModels);
await batchWork.ExecuteAsync();
}
Note: Deleting the table and then recreating it again from the web console may cause problems if using YAML/CloudFormation to create the table.