Skip to content Skip to sidebar Skip to footer

Boto3 Dynamodb Update List Attributes For An Item

I have a table like: { 'pKey': 10001, 'items': [ { 'name': 'A', 'value': 100 }, { 'name': 'B', 'value': 100 } ] } I would like to u

Solution 1:

I haven't really tested this but this is what I can come up just by reading the docs:

import boto3

ddb = boto3.resource('dynamodb')
table = ddb.Table('your_table')

document = table.get_item(Key={'pKey': 10001})['Item']

for item in document['items']:
    item['value'] = 200

table.put_item(Item=document, ReturnValues='NONE')

Post a Comment for "Boto3 Dynamodb Update List Attributes For An Item"