# tiangolo/pydantic-sqlalchemy

Tools to convert SQLAlchemy models to Pydantic models

Repository: https://github.com/tiangolo/pydantic-sqlalchemy
Canonical: https://ross.abutalabs.com/products/pydantic-sqlalchemy
Language: Python
License: MIT
License Family: permissive
Last push: 2026-08-22T03:12:59+00:00

## Health v2 (maintenance only)
Score: 83/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 99, release rhythm 52, longevity 100
- inputs: {"age_days": 2314, "days_push": 11, "days_rel": 106, "gap_med": null, "n_releases_24m": 1}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1407, forks 74 (observed 2026-08-28T04:04:38.434850+00:00)

## What it is
A small Python library that dynamically generates Pydantic models from SQLAlchemy ORM models. The author recommends using SQLModel instead, as this project is experimental and limited in usefulness.

## Use cases
- convert sqlalchemy models to pydantic models
- generate pydantic schemas from database models
- serialize sqlalchemy orm objects with pydantic
- create fastapi response models from sqlalchemy models
- auto-generate pydantic schemas for existing database tables

## When to choose
- you have a legacy codebase already using pydantic-sqlalchemy
- you need a quick one-off dynamic conversion of sqlalchemy models to pydantic

## When to avoid
- starting a new project - use SQLModel instead
- you need autocompletion and inline errors from statically defined pydantic models
- you need complex relationships or advanced validation

## Facets
- artifact type: library
- maturity: maintenance
- function: orm, serialization
- domain: databases, web-development, developer-tools
- platform: python
- tags: pydantic, sqlalchemy, model-conversion, fastapi, deprecated-in-favor-of-sqlmodel

## Member repositories
- tiangolo/pydantic-sqlalchemy (main) score 83

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:38.434850+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-30T04:38:39.933908+00:00, confidence not recorded.
  - readme: https://github.com/tiangolo/pydantic-sqlalchemy (fetched 2026-08-28T04:04:38.434850+00:00, sha 90c9b5c5470b)
  - registry_pypi: https://pypi.org/pypi/pydantic-sqlalchemy/json (fetched 2026-08-29T11:52:22.961602+00:00, sha 5f9f0674fce3)
- Data as of 2026-08-30T08:39:29.467469+00:00.
