Deleting multiple records in dynamo db

后端 未结 4 937
轮回少年
轮回少年 2021-01-12 22:54

can we delete multiple records in dynamo db only through range key?

I\'m trying to do like this sql statement

delete from employee where emplo

4条回答
  •  萌比男神i
    2021-01-12 23:12

    Based on the API, there is no Batch Delete for DynamoDB.

    http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html

    You need to query the item and delete with their partition key.

    I would recommend looking at ODM,

    https://github.com/clarkie/dynogels

    to make the operations simpler.

    Check out the sample calls for deletion,

    Account.destroy('foo@example.com', function (err) {
      console.log('account deleted');
    });
    
    // Destroy model using hash and range key
    BlogPost.destroy('foo@example.com', 'Hello World!', function (err) {
      console.log('post deleted')
    });
    
    BlogPost.destroy({email: 'foo@example.com', title: 'Another Post'}, function (err) {
      console.log('another post deleted')
    });
    

提交回复
热议问题