Name | pygination JSON |
Version |
0.0.13
JSON |
| download |
home_page | None |
Summary | Simple pagination for pydantic models and SQLAlchemy Query objects |
upload_time | 2025-01-10 16:16:18 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | None |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# 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)
```
Raw data
{
"_id": null,
"home_page": null,
"name": "pygination",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "pablete <jtamayo@enerbit.co>",
"keywords": null,
"author": null,
"author_email": "pablete <jtamayoh@gmail.com>, mike-diomedes <michael.guzman.personal@gmail.com>, jdata <jdmoralesar@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/bb/fc/dc45ec2c08ed7d31f64541fbcf8a4c7d0ad4952fe7ef42ff9223a2021f17/pygination-0.0.13.tar.gz",
"platform": null,
"description": "# Introduction \nThis module will help you paginate results from any database if you use the sqlalchemy object Query.\nThe PageModel pydantic model can be easily integrated with FastAPI and swagger. \n\n# Getting Started\n\nHere is a brief example of how to use this code.\n\n\n```\nfrom pygination import paginate\nfrom pygination.models import PageModel\n\nquery = db.query(models.City)\n\nif country_id is not None:\n query = query.filter(models.City.country_id == country_id)\n \npage = paginate(query, offset, limit)\n\nprint(page)\n# Previous page does not exist. Next page is 2. Total number of pages 4\n\npage_model = PageModel.from_orm(page)\n```",
"bugtrack_url": null,
"license": null,
"summary": "Simple pagination for pydantic models and SQLAlchemy Query objects",
"version": "0.0.13",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "183f4549a9b197a5c324454bd93d4e7466699181cf580478fd4e5c979a47e684",
"md5": "894d01960625396548add801b59f9023",
"sha256": "44ded0adfc9a15e181bdd17408dd36660e0f4b5eec8cfcae2575553bba8a0fe5"
},
"downloads": -1,
"filename": "pygination-0.0.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "894d01960625396548add801b59f9023",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 4234,
"upload_time": "2025-01-10T16:16:17",
"upload_time_iso_8601": "2025-01-10T16:16:17.380991Z",
"url": "https://files.pythonhosted.org/packages/18/3f/4549a9b197a5c324454bd93d4e7466699181cf580478fd4e5c979a47e684/pygination-0.0.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "bbfcdc45ec2c08ed7d31f64541fbcf8a4c7d0ad4952fe7ef42ff9223a2021f17",
"md5": "28fa3148eccd5111918e524dc9c88d69",
"sha256": "e641beb27a22777b6568445ebae2de55243c18181cd4daef9a92457ceefebd5a"
},
"downloads": -1,
"filename": "pygination-0.0.13.tar.gz",
"has_sig": false,
"md5_digest": "28fa3148eccd5111918e524dc9c88d69",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 53627,
"upload_time": "2025-01-10T16:16:18",
"upload_time_iso_8601": "2025-01-10T16:16:18.703964Z",
"url": "https://files.pythonhosted.org/packages/bb/fc/dc45ec2c08ed7d31f64541fbcf8a4c7d0ad4952fe7ef42ff9223a2021f17/pygination-0.0.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-10 16:16:18",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pygination"
}