Update SQL Pagination to use python-sql

* Implemented distinct