more
This commit is contained in:
@@ -33,18 +33,37 @@ Use these concepts as the planning backbone:
|
||||
|
||||
1. Engine lifecycle and ownership:
|
||||
One AsyncEngine per process for each DB URL, created once and disposed explicitly when the app lifecycle ends.
|
||||
See: [references/engine.md](references/engine.md)
|
||||
2. Session factory and scope:
|
||||
Use async_sessionmaker for configuration; create one AsyncSession per request or unit-of-work, never shared across concurrent tasks.
|
||||
See: [references/session.md](references/session.md)
|
||||
3. Transaction boundaries:
|
||||
Prefer context-managed begin blocks for write units and explicit read-only sessions for queries.
|
||||
See: [references/transactions.md](references/transactions.md)
|
||||
4. Lifespan composition:
|
||||
Compose startup/shutdown resources with AsyncExitStack so cleanup is deterministic and ordered.
|
||||
See: [references/engine.md](references/engine.md)
|
||||
5. Dependency injection:
|
||||
Provide sessions via FastAPI dependencies with async generators/context managers, not globals.
|
||||
See: [references/session.md](references/session.md)
|
||||
6. Implicit I/O control in ORM:
|
||||
Avoid accidental lazy loads; use explicit eager-loading/refresh strategies for asyncio safety.
|
||||
See: [references/implicit_io.md](references/implicit_io.md)
|
||||
7. Observability and resilience:
|
||||
Add pool/connection settings, logging, timeout, and health checks as first-class plan items.
|
||||
See: [references/observability.md](references/observability.md)
|
||||
|
||||
### Concept Reference Map
|
||||
|
||||
| Concept | Reference |
|
||||
|---|---|
|
||||
| Engine lifecycle and ownership | [references/engine.md](references/engine.md) |
|
||||
| Session factory and scope | [references/session.md](references/session.md) |
|
||||
| Transaction boundaries | [references/transactions.md](references/transactions.md) |
|
||||
| Lifespan composition | [references/engine.md](references/engine.md) |
|
||||
| Dependency injection | [references/session.md](references/session.md) |
|
||||
| Implicit I/O control in ORM | [references/implicit_io.md](references/implicit_io.md) |
|
||||
| Observability and resilience | [references/observability.md](references/observability.md) |
|
||||
|
||||
## Decision Points
|
||||
|
||||
|
||||
Reference in New Issue
Block a user