Postgres Flatten Array Python Question