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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c27f10f4cf331ef1c776c2b62bac4cb87412683ffa4d5a792571341ebc080af
|
|
| MD5 |
f010b4dd87a13ac98afa6dea6c749bda
|
|
| BLAKE2b-256 |
7e3b5842075d7aa587a8be62b6566224c5ddee9812b75bb28135be19dfbc5ff1
|
File details
Details for the file litestar_asyncpg-0.1.1-py3-none-any.whl.
File metadata
- Download URL: litestar_asyncpg-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b593570e80e5f146513e7c7964ba6695d51bdf4885295c586727ccfb0769b31
|
|
| MD5 |
414fc945e7da70aad30c5ef958e6783b
|
|
| BLAKE2b-256 |
2b3e2b2cd4850d3ebe175fc4bfd771cd9975768cc4a3b3443c84cdfdce5754bb
|