CPSC 350 - Applications of Databases - Spring 2025
Possible experience: +40XP
Due: Sunday, Mar. 2 Sunday, Mar. 9, midnight
Your mission in this homework is to import all the relevant data in the Stephen's galactic MariaDB database into your own SQLite database. This will certainly involve multiple kinds of impedance mismatches between the two schemas that you will have to overcome.
First, Google/ChatGPT to find out how to install the MariaDB client software to your machine. (As I mentioned on the cheat sheet, you do not have to download the entire MariaDB server software. Only the client is needed.
Second, make sure you have the mariadb package installed in your Python environment. If you use pip, the command will be:
$ pip install mariadb
Now, you will attempt to connect to Stephen's MariaDB instance running on the cpsc server. This is the command:
$ mariadb -u yourusername -p -h cpsc.umw.edu -P 3306 galactic
In place of yourusername, of course, you should put your actual username. Note: when you are prompted for a password, nothing will appear while you type the password: not even dots or asterisks!
When this command works, you should be connected to galactic database. Type "show tables;" and make sure it shows some table names.
Finally, you should now be able to create this program using vim (calling it "sanitycheck.py" or some such) and run it in Python:
import mariadb conn = mariadb.connect(user="yourusername", password="yourpassword", host="cpsc.umw.edu", port=3306, database="galactic")
Assuming this does not error out, you're good. All fiddly obstacles should be out of the way and you can actually think about databases.
Your goal is now to write a Python program that will read from my MariaDB database and populate your SQLite database accordingly. I will let you figure out how to do that. I'll only mention the following hints:
You will turn this assignment in by attaching a git bundle to an email. (A "git bundle" is essentially a portable, zipped-up git repo.) The subject line of the email should be "CPSC/DATA 350 Assignment #4 turn-in".
To do this, first make sure that all your code is committed to git. Running "git status" and ensuring your workspace is clean is a great way to do that. Then, bundle up your git repo:
$ git bundle create yourUmwUsername.git --all
(Please do not name it literally "yourUmwUsername.git" Substitute your actual UMW username. For instance, "jsmith7.git".)
Finally, send me the yourUmwUsername.git file as an email attachment with subject line "CPSC/DATA 350 Assignment #4 turn-in". (Double-check that it's actually attached!) If you're using the Cloud (which includes the cpsc department server) for development, then in order to get the file on your local machine to attach it to an email, you will have to download it from the Cloud.
To receive full credit, I must be able to type the following commands in sequence, verbatim, with no variations, to run your program:
$ git clone the-name-of-the-repo-you-sent-in-your-email.git temporary $ cd temporary $ python3 customer_service.py yourUmwUsername_airline.db
If I have to do any extra fiddling because these three commands, verbatim, in sequence, did not work, it's coming out of your grade.
Hint: test that this works before submitting your assignment. You can test it by creating a little temporary practice directory:
$ mkdir pretendImStephen $ cp the-name-of-your-repo.git pretendImStephen $ cd pretendImStephen
and then typing those three commands, above, to make sure they have the desired effect. (You can then get rid of that directory with "cd .." followed by "rm -rf pretendImStephen".)
Come to office hours, or send me email with subject line "CPSC 350 Assignment #4 help!!"