This exercise is available at https://study.find-santa.eu/exercises/databases/py_sqlite_owid/.
For the sake of the environment, please avoid printing these instructions in the future. Thank you!

SQLite + Python Introduction

In this exercise you will learn how to use a programming language to interact with a database. You will download live data from Our World in Data and insert the data into an SQLite database for further processing. Then you query that data using any compatible database tool. Finally, you'll query and aggregate the data using a programming language.

In order to solve this exercise, consult the official DB-API 2.0 interface for SQLite databases tutorial .

In order to understand the input data, download and open the CSV file with your favorite spreadsheet program or an editor that properly supports CSV.
  1. Insert the data for Austria and Sweden from the URL into the sqlite db for further analysis. Use this stub implementation: owid.py that creates the database and fills the Countries table. It is your duty to extend the exisiting code to fill the Mortality table.
  2. Query the cumulative excess mortality and the cumulative excess per million for Sweden and Austria via any database tool (I recommend DB Browser for SQlite, sudo apt install sqlitebrowser ).
  3. Write a second script (owid_analysis.py) that performs the above query from within Python and print the results to stdout.
  4. Modify owid_analysis.py to only print out the last common date's cumulative excess mortality and the cumulative excess mortality per million for both Sweden and Austria. The output should look like
    Country   Date        Cumulative Excess    Cumulative Excess per Million
    Austria   2022-12-11  21776.797            2435.9878
    Sweden    2022-12-11  13488.696            1278.6283