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.2.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.2.tar.gz.
File metadata
- Download URL: litestar_asyncpg-0.1.2.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 |
dc1c0aed79cf98b26c6f5dd51111d614f7696894d01b441f24f9d4454a8fe132
|
|
| MD5 |
e1e0e5000c7ca7f6c6c48b17b45c3e65
|
|
| BLAKE2b-256 |
2f65ca69252a60f7f446d5e79510352a9a47fd3c03c4167c81bdbb4b681f6b33
|
File details
Details for the file litestar_asyncpg-0.1.2-py3-none-any.whl.
File metadata
- Download URL: litestar_asyncpg-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.0 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 |
b416855cd0a306ad1b78033e10947707d99ebd1e7b757ae0e86092f42fc0589d
|
|
| MD5 |
c6e5935847d043d09899474c2b38ef8d
|
|
| BLAKE2b-256 |
b83388bb6bf1ffd0821b2d837f49e63e2e8374cf224e5fbe2acbd30c9f7fa9e7
|