The plugin reads the same DbwardenDatabase objects you already configure for migrations, so FastAPI never needs a second source of truth for connection settings. Primary.handle is a DatabaseHandle: it carries the sync engine used by migrate and the async engine used by your routes, and it exposes both as dependency annotations. The database_config(...) function API returns the same handle, so existing function-style configs get the same integration without a rewrite.
Both URLs are declared on the same object: database_url_sync for the migration tooling and database_url_async for FastAPI. The async URL conventionally uses postgresql+asyncpg://; the plugin builds the pool from that engine when the app starts.
from dbwarden import DbwardenDatabase
class Primary(DbwardenDatabase):
database_name = "primary"
default = True
database_type = "postgresql"
database_url_sync = "postgresql://user:pass@localhost:5432/myapp"
database_url_async = "postgresql+asyncpg://user:pass@localhost:5432/myapp"
model_paths = ["app.models"]