Skip to content
whichdevtool?
Categories ▾

Frameworks and UI

Frontend and full-stack frameworks Backend frameworks UI component libraries

Hosting

VPS and cloud servers App hosting and PaaS

Data

Managed databases File and object storage ORMs and database toolkits

AI

AI model APIs

Email

Transactional email APIs Email marketing and newsletters

Payments

Payments and billing

Domains and edge

Domain registrars CDN, DNS and edge security

Operations and identity

Monitoring, uptime and error tracking Auth and identity Background jobs, queues and workflows
Stacks Directory
Ctrl K

Search directory
Menu
StacksDirectory Pricing changes Glossary
VPS and cloud servers App hosting and PaaS Managed databases Transactional email APIs Email marketing and newsletters Domain registrars CDN, DNS and edge security Monitoring, uptime and error tracking Auth and identity Frontend and full-stack frameworks Backend frameworks UI component libraries AI model APIs File and object storage Payments and billing Background jobs, queues and workflows ORMs and database toolkits
  1. Home
  2. ORMs and database toolkits
  3. SQLModel
SQ

Python ORM on SQLAlchemy and Pydantic · by FastAPI (Sebastián Ramírez)

SQLModel

Thin Python ORM from the FastAPI author that combines SQLAlchemy and Pydantic, so one annotated class is both the database table and the API data model.

Visit sqlmodel.tiangolo.com ↗ Alternatives Open source Open source Self-hostable
sqlmodel.tiangolo.com
SQLModel homepage
§1

Overview

SQLModel was created by Sebastián Ramírez, the author of FastAPI, and lives in the fastapi GitHub organisation. A class that inherits from SQLModel with table=True becomes a SQLAlchemy table, and the same class validates and serialises data like a Pydantic model, so you do not keep separate ORM and API schemas in sync.

Under the hood it is SQLAlchemy: sessions, engines and the select() query style are SQLAlchemy's, and any SQLAlchemy feature can be used when SQLModel's shortcuts are not enough. Migrations are done with Alembic, as with plain SQLAlchemy. The documentation is a step-by-step tutorial aimed at people new to SQL.

The project is still versioned 0.0.x (0.0.40 on 28 August 2026) and releases regularly, but there is no 1.0 and each release can change behaviour. Advanced SQLAlchemy features sometimes need workarounds, which the docs and issues discuss. SQLModel is best treated as a convenience layer: use it for straightforward models and APIs, and reach for plain SQLAlchemy constructs in the same project when you need something it does not wrap.

§2

Pricing and plans

Plan Price What you get
SQLModel $0 MIT licence

Free and open source; there is no paid product.

Source: github.com/fastapi/sqlmodel · prices as published, excluding tax.

§3

What it does

One model for DB and API
A single annotated class is both the SQLAlchemy table and the Pydantic model used by FastAPI.
Editor support
Type annotations give autocompletion and inline errors when creating and querying models.
SQLAlchemy underneath
Engine, Session and select() are SQLAlchemy objects, so you can drop down to SQLAlchemy at any time.
Relationships
Relationship() attributes for one-to-many and many-to-many links between models.
Tutorial-style docs
Documentation teaches SQL and database basics alongside the library.
§4

Strengths and limitations

Strengths

  • Removes duplicate model definitions in FastAPI apps
  • Gentle learning curve and beginner-friendly documentation
  • Full SQLAlchemy power available when needed
  • Maintained alongside FastAPI by the same organisation

Limitations

  • Still pre-1.0 (0.0.x versions), so releases can change behaviour
  • No migration tool of its own; you set up Alembic yourself
  • Advanced SQLAlchemy patterns (complex inheritance, custom types) can be awkward through SQLModel's layer
  • Mixing table models and API models in one class can leak database fields into APIs unless you define separate read/create models
§5

Who it suits

Good for

  • FastAPI apps with straightforward data models
  • Beginners learning databases in Python
  • Small to mid-sized APIs that want less boilerplate

Look elsewhere if

  • Complex domain models that need SQLAlchemy's full mapping features directly
  • Teams that require a stable 1.0 API
§6

Alternatives to SQLModel

Tool From Free option Stages
KJ
Knex.js JavaScript SQL query builder
— Open source
Sq
sqlc SQL-to-code compiler
— Open source
SQ
SQLx Async Rust SQL toolkit
— Open source
AR
Active Record (Rails) Active Record ORM for Ruby on Rails
— Open source
EO
Eloquent ORM Active Record ORM for Laravel
— Open source
TO
Tortoise ORM Async Python ORM with a Django-like API
— Open source

All ORMs and database toolkits →

§7

Questions

Is SQLModel just SQLAlchemy?

It is a thin layer over SQLAlchemy and Pydantic; sessions, engines and queries are SQLAlchemy underneath.

How do I run migrations with SQLModel?

Use Alembic and point its target metadata at SQLModel.metadata.

Do I need FastAPI to use SQLModel?

No. It works in any Python code, though it was designed with FastAPI in mind.

Sources read for this page

  • https://sqlmodel.tiangolo.com/
  • https://github.com/fastapi/sqlmodel
  • https://sqlmodel.tiangolo.com/release-notes/
Spec sheet
From
Open source
Free tier
Free to self-host
Stages
HobbyIndieStartupScale-upEnterprise Suits hobby, indie, startup
Language
Python
Approach
Full ORM (thin layer over SQLAlchemy)
Databases
Any SQLAlchemy database: PostgreSQL, MySQL, SQLite and more
Migrations
Via Alembic (SQLAlchemy's tool); none built in
Open source
Yes
Self-host
Yes
EU data
Not stated
Category
ORMs
Visit sqlmodel.tiangolo.com ↗

To report an out-of-date price or limit, use the correction form.

whichdevtool?

Developer and cloud tools compared on price, free tier and limits, each with its source. For side projects, solo developers and small teams.

Categories

  • VPS and cloud servers
  • App hosting and PaaS
  • Managed databases
  • Transactional email APIs
  • Email marketing and newsletters
  • Domain registrars
  • CDN, DNS and edge security
  • Monitoring, uptime and error tracking
  • Auth and identity
  • Frontend and full-stack frameworks
  • Backend frameworks
  • UI component libraries
  • AI model APIs
  • File and object storage
  • Payments and billing
  • Background jobs, queues and workflows
  • ORMs and database toolkits

Research

  • Directory
  • Stacks by project
  • Developer news
  • Pricing changes
  • Glossary

Site

  • About and methods
  • How we make money
  • Suggest a tool or fix
  • Privacy
© 2026 whichdevtool.com Prices change. Each tool page links to its source. We may earn a commission when you sign up through links on this site. How we make money