Postgresql Create Array In Python For Loop