Adding SQL queries to python script