handle nesting of shared_db_connection decorator and with db.transaction