forked from AnupamAS0x1/buildanu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Text.txt
25 lines (22 loc) · 975 Bytes
/
Text.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python3.9
import boto3
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
#Variables that we are using to put items into our tables.
Planets = [
{'PlanetName': "Earth", "Quadrant": "Alpha"},
{'PlanetName': "Vulcan", "Quadrant": "Alpha"},
{'PlanetName': "Cardassia", "Quadrant": "Alpha"},
{'PlanetName': "Qo'noS", "Quadrant": "Beta"},
{'PlanetName': "Talos IV", "Quadrant": "Alpha"},
{'PlanetName': "Risa", "Quadrant": "Alpha"},
{'PlanetName': "Bajor", "Quadrant": "Alpha"},
{'PlanetName': "Saturn", "Quadrant": "Alpha"},
{'PlanetName': "Ferenginar", "Quadrant": "Alpha"},
{'PlanetName': "Talaxia", "Quadrant": "Delta"},
]
table = dynamodb.Table("Federation") #Creates a variable that will call our table name.
with table.batch_writer() as batch: #Batch writer statement that will upload a batch of items to dynamoDB.
for planet in Planets:
batch.put_item(
Item=planet
)