Skip to content

Instantly share code, notes, and snippets.

@reisjr
Created January 7, 2021 20:26
Show Gist options
  • Save reisjr/02a5167193f97c11cf9dc919e1254803 to your computer and use it in GitHub Desktop.
Save reisjr/02a5167193f97c11cf9dc919e1254803 to your computer and use it in GitHub Desktop.
DynamoDB Snippets
#!/usr/bin/python
# -*- coding: utf-8 -*-
import boto3
ddb_cli = boto3.client('dynamodb')
ddb_cli.update_item(TableName='Table1',
Key={'Pk': {'S': 'foo'}, 'Sk': {'S': 'bar'}},
UpdateExpression='SET st.#k1 = :v1',
ExpressionAttributeNames={'#k1': '0'},
ExpressionAttributeValues={':v1': {'M': {'t': {'N': '0'
}, 'l': {'S': 'label'}}}})
ddb_cli.update_item(TableName='Table1',
Key={'Pk': {'S': 'foo'}, 'Sk': {'S': 'foo'}},
UpdateExpression='SET st = :v1',
ExpressionAttributeValues={':v1': {'M': {'0': {'M': {'t': {'N': '0'
}, 'l': {'S': 'label'}}}}}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment