luplo.core.db¶
Database connection management.
Provides a thin wrapper around psycopg_pool.AsyncConnectionPool so the
rest of the codebase doesn’t import pool internals directly.
Attributes¶
Functions¶
|
Create and open an async connection pool. |
|
Gracefully close a connection pool. |
Module Contents¶
- luplo.core.db.DEFAULT_DB_URL = 'postgresql://localhost/luplo'¶
- luplo.core.db.Pool¶
- async luplo.core.db.create_pool(db_url: str | None = None, *, min_size: int = 1, max_size: int = 5) Pool¶
Create and open an async connection pool.
- Parameters:
db_url – PostgreSQL connection string. Falls back to
LUPLO_DB_URLenv var, thenpostgresql://localhost/luplo.min_size – Minimum connections kept open.
max_size – Maximum concurrent connections.
- Returns:
An open
AsyncConnectionPoolready for use.