python example of connecting to sql db and using data in a priority queue