Simple pagination for pydantic models and SQLAlchemy Query objects
Project description
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygination-0.0.13.tar.gz.
File metadata
- Download URL: pygination-0.0.13.tar.gz
- Upload date:
- Size: 53.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e641beb27a22777b6568445ebae2de55243c18181cd4daef9a92457ceefebd5a
|
|
| MD5 |
28fa3148eccd5111918e524dc9c88d69
|
|
| BLAKE2b-256 |
bbfcdc45ec2c08ed7d31f64541fbcf8a4c7d0ad4952fe7ef42ff9223a2021f17
|
Provenance
The following attestation bundles were made for pygination-0.0.13.tar.gz:
Publisher:
python-publish.yml on enerBit/pygination
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygination-0.0.13.tar.gz -
Subject digest:
e641beb27a22777b6568445ebae2de55243c18181cd4daef9a92457ceefebd5a - Sigstore transparency entry: 161387283
- Sigstore integration time:
-
Permalink:
enerBit/pygination@ed96172fdf225b5553fd1dda0c735cbc1b2769d3 -
Branch / Tag:
refs/tags/v0.0.13 - Owner: https://github.com/enerBit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ed96172fdf225b5553fd1dda0c735cbc1b2769d3 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygination-0.0.13-py3-none-any.whl.
File metadata
- Download URL: pygination-0.0.13-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ded0adfc9a15e181bdd17408dd36660e0f4b5eec8cfcae2575553bba8a0fe5
|
|
| MD5 |
894d01960625396548add801b59f9023
|
|
| BLAKE2b-256 |
183f4549a9b197a5c324454bd93d4e7466699181cf580478fd4e5c979a47e684
|
Provenance
The following attestation bundles were made for pygination-0.0.13-py3-none-any.whl:
Publisher:
python-publish.yml on enerBit/pygination
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygination-0.0.13-py3-none-any.whl -
Subject digest:
44ded0adfc9a15e181bdd17408dd36660e0f4b5eec8cfcae2575553bba8a0fe5 - Sigstore transparency entry: 161387285
- Sigstore integration time:
-
Permalink:
enerBit/pygination@ed96172fdf225b5553fd1dda0c735cbc1b2769d3 -
Branch / Tag:
refs/tags/v0.0.13 - Owner: https://github.com/enerBit
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ed96172fdf225b5553fd1dda0c735cbc1b2769d3 -
Trigger Event:
release
-
Statement type: