Asynchronous Database Access with GINO
summary
An async ORM named GINO implements PostgreSQL access with asyncpg and SQLAlchemy Core, avoiding session-managed state by returning plain Python objects. It shows a real deadlock caused by the default 10-connection pool when blocking awaits are used, then builds a solution: an async engine plus a loader system that maps query rows into object instances, supports complex multi-CTE queries and manual relationship loading, uses Alembic for migrations, and reports that the approach works in production.
AI-written summary · about
chapters (13)
- 0:00Introduction to async DB access
- 2:18ORM vs raw SQL trade-offs
- 4:24Async DB access challenges
- 7:12Avoid blocking the main thread
- 9:01Evolution of async ORMs
- 10:29Introducing GINO's design
- 13:16Pure Python model instances
- 14:43Async query execution
- 16:32Loading results into models
- 18:56Binding engine to models
- 20:43CRUD operations in GINO
- 22:28Handling relationships
- 25:43Summary and future of GINO
