Skip to main content

Introduction

This module will help you paginate results from any database if you use the sqlalchemy object Query. The PageModel pydantic model can be easily integrated with FastAPI and swagger.

Getting Started

Here is a brief example of how to use this code.

from pygination import paginate
from pygination.models import PageModel

query = db.query(models.City)

if country_id is not None:
    query = query.filter(models.City.country_id == country_id)
    
page = paginate(query, offset, limit)

print(page)
# Previous page does not exist. Next page is 2. Total number of pages 4

page_model = PageModel.from_orm(page)

Download files

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

Source Distribution

pygination-0.0.12.tar.gz (53.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygination-0.0.12-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file pygination-0.0.12.tar.gz.

File metadata

  • Download URL: pygination-0.0.12.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pygination-0.0.12.tar.gz
Algorithm Hash digest
SHA256 3e1cedc5d874799116ecbcc5af20f993b47eddedc6352d65661ff24efd774917
MD5 242515d115cff3569e51d5b9bf427927
BLAKE2b-256 625400a10f2c75724819e6cc979de1d53abf329c4e64f37b400c0491c0638f4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygination-0.0.12.tar.gz:

Publisher: python-publish.yml on enerBit/pygination

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pygination-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: pygination-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pygination-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ed8e7a6f3c1f467c2c61d7b284878e60f8a428d30f38c86e77db1109bde278b0
MD5 0c39b8c317583b746f30a04b837a0129
BLAKE2b-256 1808e8137952455ebfb48f68a5b8bfa642c6e1f7fde7dc5e126dc5154e919df1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygination-0.0.12-py3-none-any.whl:

Publisher: python-publish.yml on enerBit/pygination

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.0.13

2 files

This release

0.0.12 This release

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page