Advanced assignment
Interfacing to SQLite from Python
Completing this assignment will raise your grade one step.
The purpose of this assignment is to practice using an SQL database from Python. By mastering this, which is not very hard, you have learned a great way of easily saving and accessing data. Moreover, you have immediate access to very advanced data manipulation.
Your task is to solve the exercises in "Your own database" using a Python program instead of using pure SQL interactively.
Use the standard Python module sqlite3 and write a program that, when called from the command line, solves the tasks. The output from the program should be clearly printed and tabulated to stdout. Simply "echoing" the result from a select is not sufficient; you must show that you can extract columns of data from a SELECT command to be ready to process it in some way.
To present:
- Your Python program, code and test runs
- How do you extract the data from the results of SELECT commands?
- What happens when you insert Sus scrofa a second time?