This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A small utility to paginate SqlAlchemy queries.

Project Description
# sqlalchemy-pagination

[![Build Status](](

## Contents

1. [About](#about)
2. [Install](#install)
3. [Usage](#usage)
4. [Hacking](#hacking)
1. [Setup](#setup)
2. [Testing](#testing)
3. [Coding conventions](#coding-conventions)

## About

A small utility to paginate SqlAlchemy queries..

## Install

Just do:

$ pip install git+ssh://

## Usage

Just import the paginate method and call it with the query, the current page and the page size

from sqlalchemy_pagination import paginate

page = paginate(session.query(User), 1, 25)

The pagination objects has the following attributes

* `items`: The items of the current page base on the query
* `total`: Total number of items
* `pages`: Total number of pages
* `has_next`: Boolean indication wether there are more pages to fetch
* `has_previous`: Boolean indicating wether there are previous pages
* `next_page`: Next page number or None if the current page is the last one
* `previous_page`: Previous page number or None if the current page is the last one

## Hacking

### Setup

First install Python 3 from [Homebrew]( and virtualenvwrapper:

brew install python3
pip3 install virtualenv virtualenvwrapper

After installing virtualenvwrapper please add the following line to your shell startup file (e.g. ~/.zshrc):

source /usr/local/bin/

Then reset your terminal.

Clone this respository and create the virtual environment:

$ git clone
$ cd sqlalchemy-pagination
$ mkvirtualenv sqlalchemy-pagination
$ workon sqlalchemy-pagination
$ pip install -r requirements-dev.txt
$ pip install tox

### Testing

To run the tests, you just do:

$ tox

### Coding conventions

We use `editorconfig` to define our coding style. Please [add editorconfig](
to your editor of choice.

When running `tox` linting will also be run along with the tests. You can also run linting only by doing:

$ tox -e flake8
Release History

Release History

This version
History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
sqlalchemy-pagination-0.0.1.tar.gz (3.0 kB) Copy SHA256 Checksum SHA256 Source Apr 19, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting