story input query to mysql db with pymsql on index view