In this project, you'll add some new tables for alternative lake names and alligator sightings. You can test your code with this tester script, though it does not contain all the tests that I will use.Part 0, 20 points: Create a new table, aliases, which keeps track of alternative names of lakes. The fields should be:- actual_name: The name of the lake as it appears in the lakes table.
- alias: The alternative name of the lake.
Populate the table with the alternative names, based on the Polk County Water Atlas records of the lakes and the initial sheet I handed out. There are two ways aliases can exist:- Aliases that are included on the lake page (small text under the large text), and
- Differences between the lake name and what was given on the initial sheet. (There is at least one that differs because of a space.) Consider the name from the original sheet to be the main one and the online listing to be the alias.
Part 1, 10 points: Improve your aliases table by adding appropriate restrictions to the alias field.
Part 2, 10 points: Improve your aliases table by setting an appropriate primary key for the table.
Part 3, 10 points: There must be a way to prevent addition of records into aliases that use actual lake names that aren't in the lakes table! There must be a way! Do it! (Hint: Foreign Keys.) If this isn't working for you, you probably need to turn on enforcement of this. If you're getting a mismatch error, remember that Foreign Keys should map onto Primary Keys.
Part 4, 20 points: Create another table, gator_sightings, with these fields:- lake: The name of the lake where the gator(s) was/were sighted.
- num_gators: The number of gators that was sighted.
- date: The date the sighting occurred. I hate filling out dates, so all my tests just use the Date() function to generate the current date. That's fine.
In addition to setting up the field basics, add any constraints that are reasonable. (Exception: you don't need to test the timing of the gator sightings, e.g. with CURRENT_TIME. I had trouble getting that to work with my Python testing code.) I will check for whatever I can think of!
Part 5, 20 points: Write a python function, add_gator_sighting(db_connection, lake, num_gators) that adds a new record to the table. You can assume that the date is current, so it just calls the Date() function. Be careful to keep your function safe; I will try to break it!
Part 6, 10 points: Update add_gator_sighting so that it works even if the given lake name is an alias. (Naturally, it should add the actual name to the table.)
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 _project2.py
all in snake_case. (For example, my file name would be: kburke_project2.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.