luplo.core.db ============= .. py:module:: luplo.core.db .. autoapi-nested-parse:: Database connection management. Provides a thin wrapper around ``psycopg_pool.AsyncConnectionPool`` so the rest of the codebase doesn't import pool internals directly. Attributes ---------- .. autoapisummary:: luplo.core.db.DEFAULT_DB_URL luplo.core.db.Pool Functions --------- .. autoapisummary:: luplo.core.db.create_pool luplo.core.db.close_pool Module Contents --------------- .. py:data:: DEFAULT_DB_URL :value: 'postgresql://localhost/luplo' .. py:data:: Pool .. py:function:: create_pool(db_url: str | None = None, *, min_size: int = 1, max_size: int = 5) -> Pool :async: Create and open an async connection pool. :param db_url: PostgreSQL connection string. Falls back to ``LUPLO_DB_URL`` env var, then ``postgresql://localhost/luplo``. :param min_size: Minimum connections kept open. :param max_size: Maximum concurrent connections. :returns: An open ``AsyncConnectionPool`` ready for use. .. py:function:: close_pool(pool: Pool) -> None :async: Gracefully close a connection pool.