![]() | |
Project 1: Assigned: Mon Sep 02 2024 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 |