Back
Close

Computing with Data

elgeish
33.1K views

Amazon DynamoDB - Part V

To get all reminders that belong to a specific user, we scan the table using the following attribute condition:

from pprint import pprint

import boto3
from boto3.dynamodb.conditions import Attr

dynamodb = boto3.resource('dynamodb')
response = dynamodb.Table('reminder').scan(
  FilterExpression=Attr('userID').eq('geish@voicera.ai')
)
pprint(response['Items'])
## [{u'text': u'batch write example',
##    u'timestamp': Decimal('1511647270'),
##    u'ttl': Decimal('1511733670'),
##    u'userID': u'geish@voicera.ai'},
##  {u'text': u'another item to write',
##    u'timestamp': Decimal('1511650870'),
##    u'ttl': Decimal('1511737270'),
##    u'userID': u'geish@voicera.ai'}]
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants