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.3.tar.gz
(72.6 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.3.tar.gz.
File metadata
- Download URL: litestar_asyncpg-0.1.3.tar.gz
- Upload date:
- Size: 72.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9913ad0f9a5562f5bfb129b9a7a6b3846d568a9e7b1e1cbda9bf78663675b56
|
|
| MD5 |
e2c5f1438ab20eb66cc41c8bb50b3585
|
|
| BLAKE2b-256 |
f5da6873c5f7eb3ccddc9e20cfcb1a7c1b16a2480604b35e51c3a21c5419d9c6
|
File details
Details for the file litestar_asyncpg-0.1.3-py3-none-any.whl.
File metadata
- Download URL: litestar_asyncpg-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.1 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 |
1ffefb872b5dfece47ec1c4a4e5592ce2389af2b361306810073a47273c4268b
|
|
| MD5 |
2bd4c1d7de3f4f169656afc3568450f6
|
|
| BLAKE2b-256 |
6721b08a968864dfffb6a6adfd5a1a20476b9ea9a4d2689de37c0a6771b5a5c8
|