pygination


Namepygination JSON
Version 0.0.11 PyPI version JSON
download
home_pagehttps://github.com/jdmoralesar/pygination
SummarySimple pagination for pydantic models and SQLAlchemy Query objects
upload_time2023-07-24 16:42:09
maintainer
docs_urlNone
authorEnerbit
requires_python>=3.7
license
keywords python pagination
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": "https://github.com/jdmoralesar/pygination",
    "name": "pygination",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "python pagination",
    "author": "Enerbit",
    "author_email": "jdmoralesar@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/56/7d/c3a145722921c4e29b641886ea390eddde94949f4135a18a680dda95249a/pygination-0.0.11.tar.gz",
    "platform": null,
    "description": "\n# 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```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Simple pagination for pydantic models and SQLAlchemy Query objects",
    "version": "0.0.11",
    "project_urls": {
        "Download": "https://github.com/jdmoralesar/pygination/archive/refs/tags/0.0.1.tar.gz",
        "Homepage": "https://github.com/jdmoralesar/pygination"
    },
    "split_keywords": [
        "python",
        "pagination"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0dd3b2873cfa009a58041461e2ac78e8acfbf1597ca7ea106489310271e14282",
                "md5": "8fa192577097bd4fd7b9dacef32bdb2b",
                "sha256": "e9f0acf6e112a9ba800a726d7dacd27493e6f4bc09793f81f6178ae0fa3cb6a6"
            },
            "downloads": -1,
            "filename": "pygination-0.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8fa192577097bd4fd7b9dacef32bdb2b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4475,
            "upload_time": "2023-07-24T16:42:07",
            "upload_time_iso_8601": "2023-07-24T16:42:07.952095Z",
            "url": "https://files.pythonhosted.org/packages/0d/d3/b2873cfa009a58041461e2ac78e8acfbf1597ca7ea106489310271e14282/pygination-0.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "567dc3a145722921c4e29b641886ea390eddde94949f4135a18a680dda95249a",
                "md5": "153598697076ffcd17d6f7f945c96ef5",
                "sha256": "1f0a4546965b47454c0014aa3349ef8168429f2e6d5dfe0812724f72f387e07d"
            },
            "downloads": -1,
            "filename": "pygination-0.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "153598697076ffcd17d6f7f945c96ef5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 3964,
            "upload_time": "2023-07-24T16:42:09",
            "upload_time_iso_8601": "2023-07-24T16:42:09.451233Z",
            "url": "https://files.pythonhosted.org/packages/56/7d/c3a145722921c4e29b641886ea390eddde94949f4135a18a680dda95249a/pygination-0.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-24 16:42:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jdmoralesar",
    "github_project": "pygination",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pygination"
}
        
Elapsed time: 0.30887s