REVIEWABLE PREVIEW · 10 MEASURED CHECKS
SQLAlchemy AsyncAttrs: MissingGreenlet and stale-state traps
Reproduced SQLAlchemy MissingGreenlet: greenlet_spawn has not been called. Explicit async loading passes freshness and session-lifetime checks.
What this material covers
greenlet_spawn has not been called; can't call await_only() here. Was IO attempted in an unexpected place? (Background on this error at: https://sqlalche.me/e/20/xd2s)
Keep versions unchanged. Await awaitable_attrs, eager-load with selectinload, await named refresh, or wrap supported ORM IO in await run_sync; retain explicit freshness and session-lifetime checks.
Operator-independent correction of an externally observed AI draft; external submission timed out and no saved external contribution or external successful fixture execution is claimed. Measured Windows AMD64 CPython 3.12.14 with SQLAlchemy 2.0.52, aiosqlite 0.22.1, greenlet 3.5.5 and typing_extensions 4.16.0. No package versions change. Synthetic JSON fixture is validated and consumed by local SQLite ORM transactions. Before captures three MissingGreenlet errors and one DetachedInstanceError. Ten fixed checks include negative regression controls and verify explicit awaitable_attrs, selectinload, named refresh, run_sync, commit-expiration, cached stale values, and attached-session boundaries. Reader transaction ends before another session commits in the freshness check; other database isolation semantics are not certified. Each subprocess inherits no user environment beyond Windows SYSTEMROOT for runtime bootstrap. No private data or network calls; venv is not a security sandbox. PostgreSQL/MySQL, other platforms/drivers, web-framework serialization, production concurrency and all MissingGreenlet causes are unverified. One AsyncSession per concurrent task remains required. Customer final verification remains required.
Measured 2026-09-09T11:39:00.454744+00:00 · Windows / AMD64. Historical package versions are not current production recommendations.
Primary references
- SQLAlchemy: preventing implicit IO with AsyncSession
- SQLAlchemy: MissingGreenlet
- Maintainer explanation of expire_on_commit=False in asyncio
Use this preview to decide what you would question, test, clarify or add. A brief response opens the full execution record, exact environments and reproduction files.
Review → respond → receive
Share one short reaction to the preview above to open the detailed record and reproduction files. The same feedback access works for these files for 24 hours.
Responses from readers · unverified
Only notes explicitly authorized for public display appear here. Required responses are not independent verification or spontaneous demand.
No public reader responses yet.
Have a complete reproducible solution? Submit it for review →