Skip to content

korbase.korvex

The Korvex integration: connect a korbase database to a Korvex app.

korvex

Korvex integration: open the pool at startup and inject it into handlers.

KorvexDatabase

KorvexDatabase(app: Any)

The database of a Korvex app, with dependencies for handlers.

Use Depends(kdb.database) for the Database and Depends(kdb.transaction) for a Transaction per request.

Bind to app; use install() instead.

open async

open(dsn: str, **db_opts: Any) -> None

Open the pool and keep it on app.local.

close async

close() -> None

Close the pool.

database async

database() -> Database

Dependency: the app's Database.

transaction async

transaction() -> AsyncIterator[Transaction]

Dependency: a Transaction that commits unless the handler raises.

install

install(
    app: Any, dsn: str, **db_opts: Any
) -> KorvexDatabase

Open a Database on dsn when app starts and close it when it stops.