Overview
While we are waiting for Caleb to see if he can fix the bug in gasp that
keeps us from running robots.py
on Windows and Linux, let's
return to Dr. Chuck.
This week we will learn about how to connect Python to a database. We will begin by learning about what a database is and a bit about the history of databases.
Friday, April 16th
Classwork
We will start class with a discussion of question 3 from the homework, where your teacher messed up (and got mixed up). He understood the concept, but had the vocabulary wrong. We should have been contrasting imperative programming languages, like Python, with declarative programming languages, like SQL.
Next we will discuss how to interact with the SQLite database engine. We will look at both CLI and GUI tools.
Next week, we will learn how to access SQLite programmatically from Python.
Homework
Install sqlite3 and SQLite Browser and use one of them to create your first database. I will be available between 7:30 and 10:30 am on Monday. Please see me if you need help getting SQLite working. The CLI tool, sqlite3, is available on our student webserver, so you could access it there if you can't get it working on your local machine.
Watch the second video, Databases - Single Table SQL - Part 2 from
Lesson 15: Databases.
Then create several scripts from Dr. Chuck's handout (linked below), and
experiment with creating and modify tables using them. Put the scripts,
but not the database, in your git repo. Add *.db
to your
.gitignore
to keep the database file from ending up there.
Note: You should not store your database file in your git repo. Instead, store a script which could be used to recreate it.
Evaluation
Create a new directory in your csc200
git repo named
sqlite
. Add several sql scripts to this directory showing the
experiments you did with sqlite. Daryus, I still need to get a working
link to your git repo.
This assignment should be completed by 3 pm on Monday.
Resources
Wednesday, April 14th
Classwork/Homework
Watch Dr. Chuck's first video lecture in the Lesson 15: Databases, taking good notes. Then answer the six questions in the What is a database? assignment on Canvass.
Evaluation
Your grade this week will be determined by the completeness and correctness of your answers to the What is a database? questions.