Created
May 28, 2020 16:52
-
-
Save mholmes-hs/846d627a8abb336bf5a9eecdad7d67ef to your computer and use it in GitHub Desktop.
Scan first and last names in DynamoDB
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 scan_first_and_last_names(): | |
dynamodb = boto3.resource('dynamodb') | |
table = dynamodb.Table('Users') | |
resp = table.scan(ProjectionExpression="first_name, last_name") | |
print(resp['Items']) | |
''' | |
[ | |
{'last_name': 'Doe2', 'first_name': 'Jon'}, | |
{'last_name': 'Doe1', 'first_name': 'Jon'}, | |
{'last_name': 'Doe0', 'first_name': 'Jon'} | |
] | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment