Asyncpg plugin for Litestar
Project description
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])
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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.5.0.tar.gz.
File metadata
- Download URL: litestar_asyncpg-0.5.0.tar.gz
- Upload date:
- Size: 133.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
48d75bd6c5dbbd0701ce0632d3af1472a759caa56ec2ae0110b8319f74014abd
|
|
| MD5 |
ce0f06662c294ec10f2406961550ff47
|
|
| BLAKE2b-256 |
1c6e75a7951ae621caf7dd44bc20a8fa7ef63ba80f704007d94a7e96f2deac1b
|
Provenance
The following attestation bundles were made for litestar_asyncpg-0.5.0.tar.gz:
Publisher:
publish.yaml on litestar-org/litestar-asyncpg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_asyncpg-0.5.0.tar.gz -
Subject digest:
48d75bd6c5dbbd0701ce0632d3af1472a759caa56ec2ae0110b8319f74014abd - Sigstore transparency entry: 248698564
- Sigstore integration time:
-
Permalink:
litestar-org/litestar-asyncpg@a87becf6f1dc818466aa3c83a81730aec5ff46f0 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/litestar-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@a87becf6f1dc818466aa3c83a81730aec5ff46f0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file litestar_asyncpg-0.5.0-py3-none-any.whl.
File metadata
- Download URL: litestar_asyncpg-0.5.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27180ff4b8338b6a74595b21fae9aaef4985688b40169d5b1862391e20b2b4e5
|
|
| MD5 |
63aff28f984285f803c66967810409a8
|
|
| BLAKE2b-256 |
6f1c1150bfb9dbcb9149ea8767f29b36919cf576e654115518ae12fae29cbb73
|
Provenance
The following attestation bundles were made for litestar_asyncpg-0.5.0-py3-none-any.whl:
Publisher:
publish.yaml on litestar-org/litestar-asyncpg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_asyncpg-0.5.0-py3-none-any.whl -
Subject digest:
27180ff4b8338b6a74595b21fae9aaef4985688b40169d5b1862391e20b2b4e5 - Sigstore transparency entry: 248698567
- Sigstore integration time:
-
Permalink:
litestar-org/litestar-asyncpg@a87becf6f1dc818466aa3c83a81730aec5ff46f0 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/litestar-org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@a87becf6f1dc818466aa3c83a81730aec5ff46f0 -
Trigger Event:
release
-
Statement type: