litestar-asyncpg


Namelitestar-asyncpg JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryAsyncpg plugin for Litestar
upload_time2023-10-08 16:55:20
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords asyncpg litestar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Litestar asyncpg

## Installation

```shell
pip install litestar-asyncpg
```

## Usage

Here is a basic application that demonstrates how to use the plugin.

```python
from __future__ import annotations

from typing import TYPE_CHECKING

from litestar import Controller, Litestar, get
from litestar_asyncpg import AsyncpgConfig, AsyncpgPlugin, PoolConfig

if TYPE_CHECKING:
    from asyncpg import Connection


class SampleController(Controller):
    @get(path="/sample")
    async def sample_route(self, db_connection: Connection) -> dict[str, str]:
        """Check database available and returns app config info."""
        result = await db_connection.fetch("select 1")
        return {"select_1": str(result)}


asyncpg = AsyncpgPlugin(config=AsyncpgConfig(pool_config=PoolConfig(dsn="postgresql://app:app@localhost:5432/app")))
app = Litestar(plugins=[asyncpg], route_handlers=[SampleController])

```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "litestar-asyncpg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "asyncpg,litestar",
    "author": "",
    "author_email": "Cody Fincher <cody.fincher@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/f5/da/6873c5f7eb3ccddc9e20cfcb1a7c1b16a2480604b35e51c3a21c5419d9c6/litestar_asyncpg-0.1.3.tar.gz",
    "platform": null,
    "description": "# Litestar asyncpg\n\n## Installation\n\n```shell\npip install litestar-asyncpg\n```\n\n## Usage\n\nHere is a basic application that demonstrates how to use the plugin.\n\n```python\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nfrom litestar import Controller, Litestar, get\nfrom litestar_asyncpg import AsyncpgConfig, AsyncpgPlugin, PoolConfig\n\nif TYPE_CHECKING:\n    from asyncpg import Connection\n\n\nclass SampleController(Controller):\n    @get(path=\"/sample\")\n    async def sample_route(self, db_connection: Connection) -> dict[str, str]:\n        \"\"\"Check database available and returns app config info.\"\"\"\n        result = await db_connection.fetch(\"select 1\")\n        return {\"select_1\": str(result)}\n\n\nasyncpg = AsyncpgPlugin(config=AsyncpgConfig(pool_config=PoolConfig(dsn=\"postgresql://app:app@localhost:5432/app\")))\napp = Litestar(plugins=[asyncpg], route_handlers=[SampleController])\n\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Asyncpg plugin for Litestar",
    "version": "0.1.3",
    "project_urls": {
        "Changelog": "https://cofin.github.io/litesatr-asyncpg/latest/changelog",
        "Discord": "https://discord.gg/X3FJqy8d2j",
        "Documentation": "https://cofin.github.io/litesatr-asyncpg/latest/",
        "Homepage": "https://cofin.github.io/litesatr-asyncpg/latest/",
        "Issue": "https://github.com/cofin/litestar-asyncpg/issues/",
        "Source": "https://github.com/cofin/litestar-asyncpg"
    },
    "split_keywords": [
        "asyncpg",
        "litestar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6721b08a968864dfffb6a6adfd5a1a20476b9ea9a4d2689de37c0a6771b5a5c8",
                "md5": "2bd4c1d7de3f4f169656afc3568450f6",
                "sha256": "1ffefb872b5dfece47ec1c4a4e5592ce2389af2b361306810073a47273c4268b"
            },
            "downloads": -1,
            "filename": "litestar_asyncpg-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bd4c1d7de3f4f169656afc3568450f6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7149,
            "upload_time": "2023-10-08T16:55:18",
            "upload_time_iso_8601": "2023-10-08T16:55:18.867976Z",
            "url": "https://files.pythonhosted.org/packages/67/21/b08a968864dfffb6a6adfd5a1a20476b9ea9a4d2689de37c0a6771b5a5c8/litestar_asyncpg-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f5da6873c5f7eb3ccddc9e20cfcb1a7c1b16a2480604b35e51c3a21c5419d9c6",
                "md5": "e2c5f1438ab20eb66cc41c8bb50b3585",
                "sha256": "f9913ad0f9a5562f5bfb129b9a7a6b3846d568a9e7b1e1cbda9bf78663675b56"
            },
            "downloads": -1,
            "filename": "litestar_asyncpg-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "e2c5f1438ab20eb66cc41c8bb50b3585",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 72577,
            "upload_time": "2023-10-08T16:55:20",
            "upload_time_iso_8601": "2023-10-08T16:55:20.268606Z",
            "url": "https://files.pythonhosted.org/packages/f5/da/6873c5f7eb3ccddc9e20cfcb1a7c1b16a2480604b35e51c3a21c5419d9c6/litestar_asyncpg-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-08 16:55:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cofin",
    "github_project": "litestar-asyncpg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "litestar-asyncpg"
}
        
Elapsed time: 0.13372s