Uploading data on DynamoDB using Boto3.
Create Table.
Search for DynamoDB service in AWS console and click on "Create table"
Enter the below details and click "Create"Table is created.code :upload_db.py
import boto3
db=boto3.resource('dynamodb')
table=db.Table('employees')
table.put_item(
Item={
'emp_id':"2",
'Name': "Charvik",
'Age':"4"
}
)
run the code and check console for successful update of table.
Get the data from table
# Get the data from table.
response=table.get_item(
Key={
"emp_id":"1"
}
)
print(response["Item"])
When you run above code , you can see the output.
Thank you for reading πππππππ
No comments:
Post a Comment