---
title: "SQLAlchemy 2 In Practice - Chapter 8: SQLAlchemy and the Web"
url: https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-8-sqlalchemy-and-the-web-czkvocl80
source_url: https://blog.miguelgrinberg.com/post/sqlalchemy-2-in-practice---chapter-8-sqlalchemy-and-the-web
type: article
source: "Miguel Grinberg"
published: 2026-05-16T13:37:05.033Z
updated: 2026-05-16T13:37:34.360Z
tags: ["python", "flask", "fastapi"]
reading_time: 28
upvotes: 1
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 8: SQLAlchemy and the Web

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

## Summary

The final chapter of 'SQLAlchemy 2 in Practice' covers integrating SQLAlchemy with Python web frameworks. It demonstrates two complete integration examples using Flask and FastAPI, covering key topics like namespacing SQLAlchemy imports, model serialization to JSON via to_dict() methods, and the Alchemical helper package. A practical example builds a paginated, sortable, searchable orders table with a grid.js frontend, showing how to construct dynamic queries with filtering, sorting, and pagination in a framework-agnostic queries module. Both synchronous (Flask) and asynchronous (FastAPI) implementations are provided with full project structure, Alembic migration setup, and deployment guidance.

## 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-8-sqlalchemy-and-the-web>

## Similar posts on daily.dev

- [SQLAlchemy 2 In Practice - Chapter 7: Asynchronous SQLAlchemy](https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-7-asynchronous-sqlalchemy-rwgj7jxq3) · Miguel Grinberg · 0 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/sqlalchemy-2-in-practice---chapter-8-sqlalchemy-and-the-web-czkvocl80)
