Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

batchWriteItem of dynamodb doesn't insert more than 25 itens

I'm trying insert more than 25 itens with dynamodb with this code:

    const writeBatch = async () => {
    const items = await accounts(26)

      for (let item of items) {
        const itemArray = createArray(item)
        const params = createParam(itemArray)
        dynamodb.batchWriteItem(params, (error, data) => {
            if(error) console.log(error) 
            else console.log(data)
        })
      }
    }

    writeBatch()

For this example, I tryng insert 26 itens, Each interaction for insert 25 itens or less. In the first insert 25, and in the second insert 1. But, when I search in dynambodb the last is not there.

It's the print of the each interaction of for loop: 25 itens 1 item

Can you help me in this trouble

question from:https://stackoverflow.com/questions/65829941/batchwriteitem-of-dynamodb-doesnt-insert-more-than-25-itens

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

There is a limit of 25 items per request , as well as a limit of total item size in request of 16 MB.

see here for more limitations : https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html

if you need to send more than 25 items , you can split those into separate requests.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...