Moving to SQLAlchemy 2.0: Replacing session.query() with select()
Stop using session.query(). Learn how SQLAlchemy 2.0's unified select() API decouples query construction from execution for better typing and composability.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Stop using session.query(). Learn how SQLAlchemy 2.0's unified select() API decouples query construction from execution for better typing and composability.
A step‑by‑step diagnostic guide for SQLAlchemy 1.4+ joinedload() problems: recognize symptoms, run quick checks, apply targeted fixes, and know when to escalate.
Choose the proper eager-loading strategy for SQLAlchemy relationships to avoid N+1 queries while managing memory usage. This guide compares joinedload, selectinload, subqueryload, and lazy loading with practical examples and validation steps.
SQLAlchemy 2.0’s async engine can cut latency for high‑concurrency workloads, but it adds complexity. This blog walks through the problem, setup, a worked example, trade‑offs, and actionable take‑aways for deciding whether to go async.
A low-traffic application needs to reduce database connection costs without violating response-time expectations. SQLAlchemy’s default QueuePool maintains a fixed pool_size of connections plus overflow, which can keep idle sessions open on the database side during long idle periods. NullPool is a documented alternative that opens a connection on checkout and