AWS DynamoDB snippets
How to delete data from a DynamoDB table with Python boto3
Please note that this snippet is part of the DynamoDB-Simpsons-episodes-full-example repository on GitHub.
Let's say you want to delete an item from the DynamoDB simpsonsEpisodes
table.
table = dynamodbRes.Table(TABLENAME)
response = table.delete_item(Key={
'No_Season': 99,
'No_Inseason' : 1
})
print(response)
{'ResponseMetadata': {'RequestId': 'HDBP9LNV4B5R1HHM35KEORVPKNVV4KQNSO5AEMVJF66Q9ASUAAJG',
'HTTPStatusCode': 200,
'HTTPHeaders': {'server': 'Server',
'date': 'Wed, 07 Dec 2022 16:23:22 GMT',
'content-type': 'application/x-amz-json-1.0',
'content-length': '2',
'connection': 'keep-alive',
'x-amzn-requestid': 'HDBP9LNV4B5R1HHM35KEORVPKNVV4KQNSO5AEMVJF66Q9ASUAAJG',
'x-amz-crc32': '2745614147'},
'RetryAttempts': 0}}