Courses‎ > ‎Software Development 1‎ > ‎Dyrland-Weaver‎ > ‎Work‎ > ‎

Work 09: SQLite, same great SQL taste, half the calories

posted Oct 13, 2017, 12:57 PM by JonAlf Dyrland-Weaver
Grab the freshest sample code gift from the notes-n-code repo (right here: https://github.com/stuy-softdev/notes-and-code/tree/master/smpl/03_sqlite), and set about the mission below:

  • Read data from two CSV files --- one containing students and their IDs, another linking said IDs to the students' current grades in some courses --- and create a database whose table structure mimics that of the CSV files.
    • TASK the Foist: Familiarize yourself with Python's CSV module, specifically its DictReader() method, as it will greatly expedite your work going forward. (If you are already familiar, do your team a solid and lead a tutorial.)
      • For some sample code to get you going, see csv_tester.py
  • TASK the Second: Familiarize yourself with the contents of the two provided CSV files.
  • TASK the Toid: Write db_builder.py, which will
    • create a new SQLite database
    • utilize csv.DictReader() to read each provided CSV file
    • create a table for each
    • populate each table
  • Save your work in a new repo, linked under the db1 folder as TeamName_LastF-MastF-NastF
  • PROTIPs:
    • It may be helpful during development to delete your db file between runs.
    • Read through the db_builder skeleton and talk it over BEFORE you begin making it your own...
    • Use the sqlite shell to test out SQL commands before baking them into your Python script.
Put this under 09_sqlite in the workshop.
Comments