Tools/tiangolo/pydantic-sqlalchemy

pydantic-sqlalchemy

Tools to convert SQLAlchemy models to Pydantic models

1.4k+3/wkemergingPythonMIT Licensetrending

The Lens

pydantic-sqlalchemy does one small thing: it turns your SQLAlchemy database models into Pydantic models automatically. If you use both in a Python project, FastAPI is the common case, you otherwise end up hand-writing a second set of models that mirror your tables. This generates them for you. MIT-licensed and free.

It's a tiny utility from the author of FastAPI, and it's labeled experimental, not a polished library you build a system on. For a quick script or a small project where you want Pydantic schemas off your existing tables without the boilerplate, it saves real typing.

The catch: modern stacks mostly solve this differently now, with SQLModel (also from the same author) combining SQLAlchemy and Pydantic into one model, or by generating schemas directly. Reach for this only if you specifically have separate SQLAlchemy models and want Pydantic versions fast. Otherwise, SQLModel is probably the better starting point.

Free vs Self-Hosted vs Paid

fully free

Free: MIT, free. A small single-purpose library.

Self-hosted: It's a Python package you import. Nothing to host.

Paid: No paid version. There's nothing to buy.

Free and open source, but experimental. SQLModel is usually the better starting point now.

Self-hosting ops:trivial
View pricing page →

Get tools like this every Wednesday

One featured tool, three on the radar. No fluff.

Score
62/100 · B
Adoption12/30
Maintenance20/25
Community5/20
License15/15
Analysis10/10

License: MIT License

Use freely, including commercial. Just keep the license.

Commercial use: ✓ Yes

About

Owner
Sebastián Ramírez (User)
Stars
1,408
Forks
74

Explore Further

More tools in the directory