complete db.py