Skip to main content

Litestar asyncpg

Installation

pip install litestar-asyncpg

Usage

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.1.1.tar.gz (72.3 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.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: litestar_asyncpg-0.1.1.tar.gz
  • Upload date:
  • Size: 72.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for litestar_asyncpg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3c27f10f4cf331ef1c776c2b62bac4cb87412683ffa4d5a792571341ebc080af
MD5 f010b4dd87a13ac98afa6dea6c749bda
BLAKE2b-256 7e3b5842075d7aa587a8be62b6566224c5ddee9812b75bb28135be19dfbc5ff1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for litestar_asyncpg-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b593570e80e5f146513e7c7964ba6695d51bdf4885295c586727ccfb0769b31
MD5 414fc945e7da70aad30c5ef958e6783b
BLAKE2b-256 2b3e2b2cd4850d3ebe175fc4bfd771cd9975768cc4a3b3443c84cdfdce5754bb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.3

2 files

0.1.2

2 files

This release

0.1.1 This release

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