Announcing Quart-DB
[Quart-DB](https://github.com/pgjones/quart-db) is a Quart extension that provides managed connection(s) to postgresql database(s).

Once initialised it will, by default, add a connection on `g` for every request usable via `g.connection`. Alternatively connections (and transactions) can be managed directly and explicitly.

The queries can be constructed using named `:name` parameters or `$1` positional parameters.

Quart-DB uses [asyncpg](https://github.com/MagicStack/asyncpg) to manage the connections and [buildpg](https://github.com/samuelcolvin/buildpg) to parse the named parameter bindings.

    from quart import g, Quart, websocket
    from quart_db import QuartDB
    
    app = Quart(__name__)
    db = QuartDB(app, url="postgresql://user:pass@localhost:5432/db_name")
    
    @app.get("/&lt;int:id&gt;")
    async def get_count(id: int):
        result = await g.connection.fetch_val(
            "SELECT COUNT(*) FROM tbl WHERE id = :id",
            {"id": id},
        )
        return {"count": result}
    
    @app.post("/")
    async def set_with_transaction():
        async with g.connection.transaction():
            await db.execute("UPDATE tbl SET done = $1", [True])
            ...
        return {}
    
    @app.get("/explicit")
    async def explicit_usage():
         async with db.connection() as connection:
             ...