Member-only story
How to FastSQL with SQLModel
Developer’s are known for their love of documentation, whether it’s their willingness to read it or overwhelming desire to create it…

…who I am kidding, we’d much prefer to try random things for an hour than spend 5 mins reading the carefully crafted words of the library’s author. Let alone, jot down those five common pitfalls in the README.md before pushing the latest commit.
It’s often in the corners of documentation, you find gold.
Case in point, after digging through FastAPI’s docs one afternoon, I found myself in SQLModel land; a database interaction library written for Python using Python objects, bought to you by the author of the former.
A little confused at first, the syntax felt familiar (think Pydantic / SQLAlchemy but slightly different in places) I was intrigued. Built on top of Pydantic (Data validation using Python typing) and SQLAlchemy (SQL Toolkit + ORM in Python) the library aims to simplify the code you write to create and interact with SQL data, whilst increasing developer experience.
Let’s take a look at some examples to explore this. It’s worth noting I created the following as a quick reference guide for basic CRUD interactions to compare/contrast with classic Django/SQLAlchemy patterns.