Postgresql While Loop Exit In Python Program A Controller For The Scorpion