Postgres Select Count Statement Python Programming