---
title: "SQLAlchemy 2 In Practice - Chapter 7: Asynchronous SQLAlchemy"
url: https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-7-asynchronous-sqlalchemy-rwgj7jxq3
source_url: https://blog.miguelgrinberg.com/post/sqlalchemy-2-in-practice---chapter-7-asynchronous-sqlalchemy
type: article
source: "Miguel Grinberg"
published: 2026-05-06T21:53:39.563Z
updated: 2026-05-06T21:54:06.593Z
tags: ["python", "backend"]
reading_time: 21
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# SQLAlchemy 2 In Practice - Chapter 7: Asynchronous SQLAlchemy

**[Miguel Grinberg](https://daily.dev/sources/miguelgrinberg)** · 21 min read · 0 upvotes · 0 comments

## Summary

Chapter 7 of the SQLAlchemy 2 in Practice book covers how to adapt SQLAlchemy applications to use Python's asyncio model. It explains the concept of function coloring and why all layers of an async app must be non-blocking. Topics include: choosing async database drivers (aiosqlite, aiomysql, asyncpg), replacing synchronous engine/session with create_async_engine and async_sessionmaker, setting expire_on_commit=False to avoid implicit lazy loads, reconfiguring ORM relationship loaders (replacing lazy='select' with joined, selectin, or write_only), configuring Alembic with its async template, handling the post-flush implicit I/O problem by pre-initializing list relationships, and using stream()/stream_scalars() for efficient async result iteration.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.miguelgrinberg.com/post/sqlalchemy-2-in-practice---chapter-7-asynchronous-sqlalchemy>

## Similar posts on daily.dev

- [SQLAlchemy 2 In Practice - Chapter 8: SQLAlchemy and the Web](https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-8-sqlalchemy-and-the-web-czkvocl80) · Miguel Grinberg · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#backend](https://daily.dev/tags/backend)

[View this post on daily.dev](https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-7-asynchronous-sqlalchemy-rwgj7jxq3)
