took db access out of flaskr