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)
Metadata
Release files for pygination 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pygination-0.0.9.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygination-0.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / pygination-0.0.9.tar.gz
| Download URL | pygination-0.0.9.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94dc61419f02e165ae7ab04f5a8bab588f4ab5c0c0d16a90c76121bd2a52c949
|
|
BLAKE2b-256 checksum How to use checksums |
400008d8cbdb68b1a21ecf83c91d599ce506f0d4e8a5019d0699408d0c70671f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.4
|
Release files / pygination-0.0.9-py3-none-any.whl
| Download URL | pygination-0.0.9-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7086db20e57a75004d40f4b1a694fa0edeeda8e3ba0a1c4b57b843593b45c8c
|
|
BLAKE2b-256 checksum How to use checksums |
5b184698a193b1c1d2b82b20a4af0f122c2b71ce7c0d66c37f6196cc330a65a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.4
|