Put the database and cursor into the flask.g object