SQLAlchemy Relationship Loading: Joined, Selectin, or Raise
Stop N+1 queries by choosing the right SQLAlchemy eager-loading strategy for each relationship shape.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Stop N+1 queries by choosing the right SQLAlchemy eager-loading strategy for each relationship shape.
Deciding between Flask-SQLAlchemy and raw SQLAlchemy depends on whether you prioritize rapid development or architectural decoupling. This guide compares session management, async support, and migration workflows.
Use a reusable SQLAlchemy declarative mixin with server_default=func.now() and onupdate=func.now() to let the database manage created_at and updated_at without application code.
A technical guide on implementing SQLAlchemy 2.0 in a single-writer web service, focusing on the unit-of-work pattern, connection pooling, and avoiding common ORM pitfalls like N+1 queries.
Learn how to use FastAPI's Dependency Injection system to manage database sessions and request state without leaking resources or duplicating code.
Avoid N+1 queries in SQLAlchemy by choosing selectinload for collections and joinedload for scalar relationships, then verify with echo=True.
Learn how FastAPI's Depends and yield patterns eliminate duplicated setup code and guarantee cleanup of database sessions, auth tokens, and other shared resources.
A step-by-step diagnostic guide for SQLAlchemy QueuePool exhaustion: recognize the symptoms, trace held connections, and apply staged fixes without overwhelming your database.
Learn how SQLAlchemy's joinedload replaces N+1 queries with a single JOIN for many-to-one and one-to-one relations, when to use it, and what to watch out for.