Flaxon PostSQL
flaxon-postsql is a lightweight PostgreSQL wrapper built on asyncpg. It
owns an async connection pool and exposes it as app.state.postsql.
Install
pip install flaxon-postsql
Use
import os
from flaxon import Flaxon
from flaxon_postsql import PostSQLPlugin
app = Flaxon("catalog")
await app.plugins.load_plugin(PostSQLPlugin(os.environ["DATABASE_URL"], min_size=2, max_size=10))
@app.get("/products")
async def list_products():
rows = await app.state.postsql.fetch("SELECT id, name FROM products ORDER BY id")
return {"products": [dict(row) for row in rows]}
The connection pool opens during application startup and closes during
shutdown. Always use positional $1, $2, … parameters with asyncpg; do
not build SQL with string interpolation. Store the database URL in a secret
manager or environment variable.
This project is named postsql at the package level but integrates with
PostgreSQL through asyncpg.
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 flaxon_postsql-0.1.0.tar.gz.
File metadata
- Download URL: flaxon_postsql-0.1.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14c49334704725bd61f2a08fa1de0f214d525be7753ea6206c80a5a65afd9d95
|
|
| MD5 |
cd90265cca9017a1b0be43adf5d3047d
|
|
| BLAKE2b-256 |
da6648812348a26292b5530461ab2fc27f3d3e964f10ca677609c155b8a66d1e
|
File details
Details for the file flaxon_postsql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flaxon_postsql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab465f63abcb11cd5a302ebd5c1940e34fedfa67a0d975f041681afd7d2af081
|
|
| MD5 |
a2308b7ad5a4a8820e416b01ef1eb04d
|
|
| BLAKE2b-256 |
441e46d60c8319c1edb11421c5e07aac44083ec53342c80fb9dc991246d66c38
|