Last active
May 28, 2020 15:23
-
-
Save mholmes-hs/39515b5abfd338f3f9318dac2e4cccef to your computer and use it in GitHub Desktop.
DynamoDB query examp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from boto3.dynamodb.conditions import Key | |
def query(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
resp = table.query( | |
KeyConditionExpression=Key('id').eq(1) | |
) | |
if 'Items' in resp: | |
print(resp['Items'][0]) | |
#{'id': Decimal('1'), 'email': 'jdoe@test.com', 'last_name': 'Doe', 'first_name': 'Jon'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment