Postgres Select Item In Array Python Questions For If Statement