Skip to main content

Litestar Logo - Light Litestar Logo - Dark

Project Status
CI/CD Latest Release ci Documentation Building
Quality Coverage Quality Gate Status Maintainability Rating Reliability Rating Security Rating
Package PyPI - Version PyPI - Support Python Versions Advanced Alchemy PyPI - Downloads
Community Reddit Discord Matrix Medium Twitter Blog
Meta Litestar Project types - Mypy License - MIT Litestar Sponsors linting - Ruff code style - Ruff
# 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

pip install litestar-asyncpg

Example

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

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])

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litestar_asyncpg-0.3.0.tar.gz (66.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litestar_asyncpg-0.3.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file litestar_asyncpg-0.3.0.tar.gz.

File metadata

  • Download URL: litestar_asyncpg-0.3.0.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for litestar_asyncpg-0.3.0.tar.gz
Algorithm Hash digest
SHA256 29cb9cb02ccd1fee1b12968a3224354b79346233c8b2fae6ee4f6ef869ddee0f
MD5 cd9c304074f9d7e2df5489f2ed06b28f
BLAKE2b-256 4f408e163a87b6cd1d7886d2d5b3d6e2b627478cee66b66b413ad05292e44e6e

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_asyncpg-0.3.0.tar.gz:

Publisher: publish.yaml on litestar-org/litestar-asyncpg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file litestar_asyncpg-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for litestar_asyncpg-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd01e60cf78561a7e0215d3eb064169f7a5942f796f16d83d7a77cc6714fdc4
MD5 b9c16ac0fc73271c6315315c0107a040
BLAKE2b-256 560b31ee5aa0804e7b5fcf1c6a662f39340714e32b412148917de6fc81871150

See more details on using hashes here.

Provenance

The following attestation bundles were made for litestar_asyncpg-0.3.0-py3-none-any.whl:

Publisher: publish.yaml on litestar-org/litestar-asyncpg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page