Florida Southern Seal
CSC 3340: Databases
(Fall 2024)

Syllabus

LMS

Teachers


Assignments


Other Pages

Project 1:
EnvironmenTable Protection


Assigned: Mon Sep 02 2024
Due: 11:59:00 PM on Wed Sep 11 2024
Team Size: 2
Language: Python 3 and SQLite
Out of: 100 points


In this project, you'll strengthen the robustness and security of the lakes table you already created! You can start this project by making a copy of the python file you used for the previous project. You can test your code before submitting by using this tester script, though it does not contain all the tests that I will use.

Part 0, 10 points: Update your table schema to include a primary key on the table. (Don't add any new fields, instead decide which existing field(s) the key should consist of.)

Part 1, 10 points: Update your table schema to enforce that the lake names cannot be NULL.

Part 2, 10 points: Update your table schema to enforce that the surface_area field cannot be negative. (It should be able to be NULL.)

Part 3, 10 points: Update your table schema to enforce that the volume field must be positive. (It should still be able to be NULL.)

Part 4, 10 points: Update your table schema to enforce that the max_depth field must be positive. (It should still be able to be NULL.)

Part 5, 10 points: Recalling the rules for latitudes, enforce that only legitimate latitudes work. (Don't check that the latitudes are in Lakeland, just that it's a legit Earthly latitude.)

Part 6, 10 points: Recalling the rules for longitudes, enforce that only legitimate longitudes work. (Don't check that the longitudes are in Lakeland, just that it's a legit Earthly longitude.)

Part 7, 10 points: Update your table schema to enforce that the lake names cannot be the empty string or any string with only spaces. Hint: I used an SQLite function here in my constraint.

Part 8, 20 points: SQLlite with Python is susceptible to injection attacks when executing INSERT statements. If we were going to add some security to an application using our code, we could add an add_lake function to call instead of executing user-given INSERT statements. Write this function! add_lake(db_connection, name, surface_area, volume, max_depth, latitude, longitude) should add a lake to your lakes table unless a user (me) tries to enter inappropriate data, or, for example, incorporate an SQL injection attack.

Submitting your Project:

Choose a team name that no other team will choose. Then make sure all your code is in a file labelled with your team name, followed by _project1.py all in snake_case. (For example, my file name would be: kburke_project1.py.) It's very important to name your file correctly in order for me to grade it. Make sure your code runs, then upload it to the project on Canvas. If there is already a file up on Canvas, I recommend deleting that before uploading the new version. If you submit well before the deadline, send me a message on Slack. If there's adequate time, I'll check it and post feedback on Canvas. If you submit after the deadline, please message me so I know I have something late to grade.