8000 DynamoDB Update · techiescamp/python-for-devops@d3977be · GitHub
[go: up one dir, main page]

Skip to content

Commit d3977be

Browse files
committed
DynamoDB Update
1 parent 522af1f commit d3977be

File tree

11 files changed

+589
-28
lines changed

11 files changed

+589
-28
lines changed

boto3/dynamodb/README.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Working With DynamoDB Using Boto3
2+
3+
This example shows loading sample data to dynamoDB and using boto3 to acess the data from the table.
4+
5+
Code Credits: [fernandomc.com Guide](https://www.fernandomc.com/posts/ten-examples-of-getting-data-from-dynamodb-with-python-and-boto3/)

boto3/dynamodb/createTable.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import boto3
2+
3+
dynamodb = boto3.client("dynamodb")
4+
5+
response = dynamodb.create_table(
6+
TableName="basicSongsTable",
7+
AttributeDefinitions=[
8+
{
9+
"AttributeName": "artist",
10+
"AttributeType": "S"
11+
},
12+
{
13+
"AttributeName": "song",
14+
"AttributeType": "S"
15+
}
16+
],
17+
KeySchema=[
18+
{
19+
"AttributeName": "artist",
20+
"KeyType": "HASH"
21+
},
22+
{
23+
"AttributeName": "song",
24+
"KeyType": "RANGE"
25+
}
26+
],
27+
ProvisionedThroughput={
28+
"ReadCapacityUnits": 1,
29+
"WriteCapacityUnits": 1
30+
}
31+
)
32+
33+
print(response)

0 commit comments

Comments
 (0)
0