litestar-asyncpg


Namelitestar-asyncpg JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryAsyncpg plugin for Litestar
upload_time2024-11-26 22:37:13
maintainerNone
docs_urlNone
authorNone
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.
            <!-- markdownlint-disable -->
<p align="center">
  <!-- github-banner-start -->
  <img src="https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Light.svg#gh-light-mode-only" alt="Litestar Logo - Light" width="100%" height="auto" />
  <img src="https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Dark.svg#gh-dark-mode-only" alt="Litestar Logo - Dark" width="100%" height="auto" />
  <!-- github-banner-end -->
</p>
<!-- markdownlint-restore -->

<div align="center">

<!-- prettier-ignore-start -->

| Project   |     | Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|-----------|:----|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CI/CD     |     | [![Latest Release](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml) [![ci](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml) [![Documentation Building](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Quality   |     | [![Coverage](https://codecov.io/github/litestar-org/litestar-asyncpg/graph/badge.svg?token=vKez4Pycrc)](https://codecov.io/github/litestar-org/litestar-asyncpg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg)                                                                                                    |
| Package   |     | [![PyPI - Version](https://img.shields.io/pypi/v/litestar-asyncpg?labelColor=202235&color=edb641&logo=python&logoColor=edb641)](https://badge.fury.io/py/litestar) ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/litestar?labelColor=202235&color=edb641&logo=python&logoColor=edb641) ![Advanced Alchemy PyPI - Downloads](https://img.shields.io/pypi/dm/litestar-asyncpg?logo=python&label=package%20downloads&labelColor=202235&color=edb641&logoColor=edb641)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Community |     | [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/litestarapi?label=r%2FLitestar&logo=reddit&labelColor=202235&color=edb641&logoColor=edb641)](https://reddit.com/r/litestarapi) [![Discord](https://img.shields.io/discord/919193495116337154?labelColor=202235&color=edb641&label=chat%20on%20discord&logo=discord&logoColor=edb641)](https://discord.gg/litestar) [![Matrix](https://img.shields.io/badge/chat%20on%20Matrix-bridged-202235?labelColor=202235&color=edb641&logo=matrix&logoColor=edb641)](https://matrix.to/#/#litestar:matrix.org) [![Medium](https://img.shields.io/badge/Medium-202235?labelColor=202235&color=edb641&logo=medium&logoColor=edb641)](https://blog.litestar.dev) [![Twitter](https://img.shields.io/twitter/follow/LitestarAPI?labelColor=202235&color=edb641&logo=twitter&logoColor=edb641&style=flat)](https://twitter.com/LitestarAPI) [![Blog](https://img.shields.io/badge/Blog-litestar.dev-202235?logo=blogger&labelColor=202235&color=edb641&logoColor=edb641)](https://blog.litestar.dev)                                                             |
| Meta      |     | [![Litestar Project](https://img.shields.io/badge/Litestar%20Org-%E2%AD%90%20Advanced%20Alchemy-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/litestar-org/litestar-asyncpg) [![types - Mypy](https://img.shields.io/badge/types-Mypy-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://spdx.org/licenses/) [![Litestar Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23edb641.svg?&logo=github&logoColor=edb641&labelColor=202235)](https://github.com/sponsors/litestar-org) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json&labelColor=202235)](https://github.com/astral-sh/ruff) [![code style - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json&labelColor=202235)](https://github.com/psf/black) |

</div>
# Litestar Asyncpg

A barebones AsyncPG plugin for Litestar.  This plugin is useful for when you plan to use no ORM or need to manage the postgres connection separately.

## Usage

### Installation

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

### Example

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": null,
    "name": "litestar-asyncpg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "asyncpg, litestar",
    "author": null,
    "author_email": "Cody Fincher <cody@litestar.dev>",
    "download_url": "https://files.pythonhosted.org/packages/4f/40/8e163a87b6cd1d7886d2d5b3d6e2b627478cee66b66b413ad05292e44e6e/litestar_asyncpg-0.3.0.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable -->\n<p align=\"center\">\n  <!-- github-banner-start -->\n  <img src=\"https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Light.svg#gh-light-mode-only\" alt=\"Litestar Logo - Light\" width=\"100%\" height=\"auto\" />\n  <img src=\"https://raw.githubusercontent.com/litestar-org/branding/main/assets/Branding%20-%20SVG%20-%20Transparent/asyncPG%20-%20Banner%20-%20Inline%20-%20Dark.svg#gh-dark-mode-only\" alt=\"Litestar Logo - Dark\" width=\"100%\" height=\"auto\" />\n  <!-- github-banner-end -->\n</p>\n<!-- markdownlint-restore -->\n\n<div align=\"center\">\n\n<!-- prettier-ignore-start -->\n\n| Project   |     | Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |\n|-----------|:----|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| CI/CD     |     | [![Latest Release](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/publish.yml) [![ci](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml/badge.svg)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/ci.yml) [![Documentation Building](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/litestar-org/litestar-asyncpg/actions/workflows/docs.yml)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| Quality   |     | [![Coverage](https://codecov.io/github/litestar-org/litestar-asyncpg/graph/badge.svg?token=vKez4Pycrc)](https://codecov.io/github/litestar-org/litestar-asyncpg) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=litestar-org_litestar-asyncpg&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=litestar-org_litestar-asyncpg)                                                                                                    |\n| Package   |     | [![PyPI - Version](https://img.shields.io/pypi/v/litestar-asyncpg?labelColor=202235&color=edb641&logo=python&logoColor=edb641)](https://badge.fury.io/py/litestar) ![PyPI - Support Python Versions](https://img.shields.io/pypi/pyversions/litestar?labelColor=202235&color=edb641&logo=python&logoColor=edb641) ![Advanced Alchemy PyPI - Downloads](https://img.shields.io/pypi/dm/litestar-asyncpg?logo=python&label=package%20downloads&labelColor=202235&color=edb641&logoColor=edb641)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| Community |     | [![Reddit](https://img.shields.io/reddit/subreddit-subscribers/litestarapi?label=r%2FLitestar&logo=reddit&labelColor=202235&color=edb641&logoColor=edb641)](https://reddit.com/r/litestarapi) [![Discord](https://img.shields.io/discord/919193495116337154?labelColor=202235&color=edb641&label=chat%20on%20discord&logo=discord&logoColor=edb641)](https://discord.gg/litestar) [![Matrix](https://img.shields.io/badge/chat%20on%20Matrix-bridged-202235?labelColor=202235&color=edb641&logo=matrix&logoColor=edb641)](https://matrix.to/#/#litestar:matrix.org) [![Medium](https://img.shields.io/badge/Medium-202235?labelColor=202235&color=edb641&logo=medium&logoColor=edb641)](https://blog.litestar.dev) [![Twitter](https://img.shields.io/twitter/follow/LitestarAPI?labelColor=202235&color=edb641&logo=twitter&logoColor=edb641&style=flat)](https://twitter.com/LitestarAPI) [![Blog](https://img.shields.io/badge/Blog-litestar.dev-202235?logo=blogger&labelColor=202235&color=edb641&logoColor=edb641)](https://blog.litestar.dev)                                                             |\n| Meta      |     | [![Litestar Project](https://img.shields.io/badge/Litestar%20Org-%E2%AD%90%20Advanced%20Alchemy-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/litestar-org/litestar-asyncpg) [![types - Mypy](https://img.shields.io/badge/types-Mypy-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://github.com/python/mypy) [![License - MIT](https://img.shields.io/badge/license-MIT-202235.svg?logo=python&labelColor=202235&color=edb641&logoColor=edb641)](https://spdx.org/licenses/) [![Litestar Sponsors](https://img.shields.io/badge/Sponsor-%E2%9D%A4-%23edb641.svg?&logo=github&logoColor=edb641&labelColor=202235)](https://github.com/sponsors/litestar-org) [![linting - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json&labelColor=202235)](https://github.com/astral-sh/ruff) [![code style - Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/format.json&labelColor=202235)](https://github.com/psf/black) |\n\n</div>\n# Litestar Asyncpg\n\nA barebones AsyncPG plugin for Litestar.  This plugin is useful for when you plan to use no ORM or need to manage the postgres connection separately.\n\n## Usage\n\n### Installation\n\n```shell\npip install litestar-asyncpg\n```\n\n### Example\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.3.0",
    "project_urls": {
        "Changelog": "https://litestar-org.github.io/litesatr-asyncpg/latest/changelog",
        "Discord": "https://discord.gg/X3FJqy8d2j",
        "Documentation": "https://litestar-org.github.io/litesatr-asyncpg/latest/",
        "Homepage": "https://litestar-org.github.io/litesatr-asyncpg/latest/",
        "Issue": "https://github.com/litestar-org/litestar-asyncpg/issues/",
        "Source": "https://github.com/litestar-org/litestar-asyncpg"
    },
    "split_keywords": [
        "asyncpg",
        " litestar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "560b31ee5aa0804e7b5fcf1c6a662f39340714e32b412148917de6fc81871150",
                "md5": "b9c16ac0fc73271c6315315c0107a040",
                "sha256": "8bd01e60cf78561a7e0215d3eb064169f7a5942f796f16d83d7a77cc6714fdc4"
            },
            "downloads": -1,
            "filename": "litestar_asyncpg-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9c16ac0fc73271c6315315c0107a040",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9467,
            "upload_time": "2024-11-26T22:37:12",
            "upload_time_iso_8601": "2024-11-26T22:37:12.412515Z",
            "url": "https://files.pythonhosted.org/packages/56/0b/31ee5aa0804e7b5fcf1c6a662f39340714e32b412148917de6fc81871150/litestar_asyncpg-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f408e163a87b6cd1d7886d2d5b3d6e2b627478cee66b66b413ad05292e44e6e",
                "md5": "cd9c304074f9d7e2df5489f2ed06b28f",
                "sha256": "29cb9cb02ccd1fee1b12968a3224354b79346233c8b2fae6ee4f6ef869ddee0f"
            },
            "downloads": -1,
            "filename": "litestar_asyncpg-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cd9c304074f9d7e2df5489f2ed06b28f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 66756,
            "upload_time": "2024-11-26T22:37:13",
            "upload_time_iso_8601": "2024-11-26T22:37:13.865431Z",
            "url": "https://files.pythonhosted.org/packages/4f/40/8e163a87b6cd1d7886d2d5b3d6e2b627478cee66b66b413ad05292e44e6e/litestar_asyncpg-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-26 22:37:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "litestar-org",
    "github_project": "litestar-asyncpg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "litestar-asyncpg"
}
        
Elapsed time: 0.71725s