# fastapi/sqlmodel

SQL databases in Python, designed for simplicity, compatibility, and robustness.

Repository: https://github.com/fastapi/sqlmodel
Canonical: https://ross.abutalabs.com/products/sqlmodel
Homepage: https://sqlmodel.tiangolo.com/
Language: Python
License: MIT
License Family: permissive
Topics: python, sql, sqlalchemy, pydantic, fastapi, json, json-schema
Last push: 2026-08-25T13:59:51+00:00

## Health v2 (maintenance only)
Score: 96/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 90, longevity 100
- inputs: {"age_days": 1835, "days_push": 8, "days_rel": 69, "gap_med": 5.5, "n_releases_24m": 17}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 18285, forks 884 (observed 2026-08-28T04:11:26.539366+00:00)

## What it is
SQLModel is a Python library for interacting with SQL databases using Python objects, built as a thin layer on top of SQLAlchemy and Pydantic. It lets a single type-annotated model serve as both the database schema and the validation/serialization model, minimizing code duplication.

## Use cases
- define database models with python type hints
- use one model for both orm and api validation
- interact with sql databases in a fastapi app
- avoid duplicating sqlalchemy and pydantic models
- query and persist rows using python objects
- build crud apis backed by a relational database

## When to choose
- you're building a FastAPI application that needs a SQL database
- you want Pydantic validation and SQLAlchemy ORM in a single model
- you value editor autocompletion and minimal boilerplate
- you want a simple, modern-Python ORM with sensible defaults

## When to avoid
- you need advanced SQLAlchemy features not exposed by the thin layer
- you're working outside Python or with NoSQL databases
- you already have separate mature SQLAlchemy and Pydantic model layers
- you need a fully mature 1.0-guaranteed API (it's still 0.x)

## Facets
- artifact type: library
- maturity: stable
- function: orm, database, serialization, api-framework
- domain: databases, web-development, backend, developer-tools
- platform: python, cross-platform
- tags: sqlalchemy, pydantic, fastapi, sql, type-annotations, data-modeling

## Member repositories
- fastapi/sqlmodel (main) score 96

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:11:26.539366+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:02:05.330774+00:00, confidence not recorded.
  - readme: https://github.com/fastapi/sqlmodel (fetched 2026-08-28T04:11:26.539366+00:00, sha 32be25c99dc2)
  - homepage: https://sqlmodel.tiangolo.com/ (fetched 2026-08-29T07:59:53.331567+00:00, sha 1aeb73290ed1)
  - site_page: https://sqlmodel.tiangolo.com/features (fetched 2026-08-29T07:59:53.377464+00:00, sha 4954a5e0fe57)
  - site_page: https://sqlmodel.tiangolo.com/about (fetched 2026-08-29T07:59:53.425237+00:00, sha 8542eea61759)
  - site_page: https://sqlmodel.tiangolo.com/install (fetched 2026-08-29T07:59:53.468203+00:00, sha 91654be8bb05)
  - registry_pypi: https://pypi.org/pypi/sqlmodel/json (fetched 2026-08-29T07:59:53.604777+00:00, sha 4ac611d7bb5f)
  - site_page: https://sqlmodel.tiangolo.com/databases (fetched 2026-08-29T07:59:53.546725+00:00, sha af71b5e4868a)
- Data as of 2026-08-30T08:39:29.467469+00:00.
