Add db.py for handling the sqlite database