From 5a3b31d0bd20ccf32b566e08d91733dc1048aff8 Mon Sep 17 00:00:00 2001 From: Nicholas Couillard Date: Wed, 4 Oct 2023 23:17:43 -0400 Subject: [PATCH] database groundwork --- DynamoDB.py | 23 +++++++++++++++++++++++ requirements.txt | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 DynamoDB.py create mode 100644 requirements.txt diff --git a/DynamoDB.py b/DynamoDB.py new file mode 100644 index 0000000..092accb --- /dev/null +++ b/DynamoDB.py @@ -0,0 +1,23 @@ +from boto3 import resource +from boto3.dynamodb.conditions import Attr, Key + +course_table = resource('dynamodb').Table('Courses') + +def insert(): + courseInsertion = course_table.put_item( + Item = { + 'CourseId' : 'CSE1010', # partition key + 'Section' : '001L', # sort key? + 'Professor' : 'Gregory Jackson', # TODO: support multiple instructors + 'StudentsEnrolled' : 0, + 'StartTime' : 1630, # is storing times in the form of 24-hour time easier? it's simple to convert when necessary + 'EndTime' : 1720, + 'OpenStatus' : True # this attribute could be useful for hiding unavailable courses + } + ) + + print(f"Insert response: {courseInsertion}") + +if __name__ == '__main__': + insert() + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..03def5c --- /dev/null +++ b/requirements.txt @@ -0,0 +1,25 @@ +pip3 install boto3 # installs necessary dependency + +curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" # line 1 for installing aws commandline +sudo installer -pkg AWSCLIV2.pkg -target / # line 2 for installing aws commandline + +which aws # line 1 for verifying installation was successful +aws --version # line 2 for verifying installation was successful + +aws configure # prompts for info to connect to AWS + +Tyler: +AKIAZYS7TP7NH7ZTXR4L - Access Key ID +SP/hdEJXlbdOyw53PeZGgC1t7ZA4U9RbW9cn0n9o - Secret Access Key [write this down, unrecoverable] + +Zach: +AKIAZYS7TP7NP4YXGZXK - Access Key ID +kQKm9wSkbqcUw+NDgEO7Pt8v9Vg/kLKhl4yX31dK - Secret Access Key [write this down, unrecoverable] + +Tageria: +AKIAZYS7TP7NHURRN3Z2 - Access Key ID +FXQ/ZOyK8SfhGOlF+LE7YuUxfgEVWARwZx0uCZIP - Secret Access Key [write this down, unrecoverable] + +Region: us-east-1 +Output format: json +