Postgresql Invalid Input Value In Python