finish the db.py