Skip to content

HW1: CRUD Operations

Due: Monday, Sep 2nd

SQLite logo + Python logo
Image source: Charles Leifer blog

CRUD is an acronym that stands for Create, Read, Update, and Delete—the four basic operations of persistent storage. In this assignment, you will write a program that performs CRUD operations on a table of your choice. You will become familiar with executing SQL statements in Python.

Objectives

  • Write simple CREATE TABLE, INSERT, UPDATE, and DELETE statements.
  • Use Python's DB-API to execute queries and fetch results from SQLite.

Instructions

Download the provided hw1.py template. Implement each of the functions as described in the docstrings. Notice that, for some of the functions, you will need to add parameters. Modify the provided code under __main__ to call each function with reasonable arguments. Be sure to complete all tasks specified in the TODO comments. Run your code offline before submitting to Gradescope.

You may find the following documentation and tutorial pages useful:

Submission

Submit your hw1.py to the HW1 assignment on Gradescope.

Your code will first be graded by Gradescope and then by the professor. The grade you receive from Gradescope is the maximum grade that you can receive on the assignment.

After the due date, the professor may manually review your code. At that time, points may be deducted for inelegant code, inappropriate variable names, bad comments, etc.

Gradescope will provide you with hints but might not completely identify the defects in your submission. You are expected to test your own code before submitting.

There is no limit on the number of submissions and no penalty for excessive submissions. Points will be allocated as follows:

Criterion Points Details
Autograder 80 pts Partial Credit Possible
Code Review 20 pts Partial Credit Possible

The code review will include:

  1. Your table's design (column names and data types).
  2. The sample data in you wrote in insert_sample().
  3. Additions you made to the provided docstrings.
  4. Changes you made to the code under __main__.