Skip to content

Instantly share code, notes, and snippets.

@rmchale
Last active April 2, 2020 16:42
Show Gist options
  • Save rmchale/63c6c5a12d2314bd731be6d101d1131c to your computer and use it in GitHub Desktop.
Save rmchale/63c6c5a12d2314bd731be6d101d1131c to your computer and use it in GitHub Desktop.
import boto3
dynamodb = boto3.client('dynamodb', region_name='us-east-2')
dynamodb.put_item(TableName='emails',
Item={
'id': {'S': 'ryan.mchale@gmail.com'}
}
)
import boto3
dynamodb = boto3.client('dynamodb', region_name='us-east-2')
table = dynamodb.get_item(TableName='emails',
Key={
'id': {'S': 'ryan.mchale@gmail.com'}
}
)
print('exists' if 'Item' in table else 'does not exist');
table = dynamodb.get_item(TableName='emails',
Key={
'id': {'S': 'foo'}
}
)
print('exists' if 'Item' in table else 'does not exist');
boto3==1.12.34
botocore==1.15.34
docutils==0.15.2
jmespath==0.9.5
python-dateutil==2.8.1
s3transfer==0.3.3
six==1.14.0
urllib3==1.25.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment