Postgresql Window Function Count Python Command To Create