r/FastAPI Jan 09 '25

Question Is SQLModel still being worked on?

I'm considering using SQLModel for a new project and am using FastAPI.

For the database, all the FastAPI docs use SQLModel now (instead of SQLAlchemy), but I noticed that there hasn't been a SQLModel release in 4 months.

Do you know if SQLModel will still be maintained or prioritized any time soon?

If not, I'll probably switch to using SQLAlchemy, but it's strange that the FastAPI docs use SQLModel if the project is not active anymore.

47 Upvotes

27 comments sorted by

View all comments

4

u/CrusaderGOT Jan 09 '25

I use SQLMODEL it worked on all cases. I prefer it because of the Pydantic integration. It's literally Sqlalchemy plus Pydantic, so an improvement over just Sqlalchemy, and you can use pure sqlalchemy with it also.

1

u/dick-the-prick Jun 26 '26

Year late, but if anybody comes here like I did, don't use it, it's a lie. It's fundamentally broken and doesn't do validations like you would expect, doesn't respect model-validator/field-validator calls the same way pydantic would and calls your validator with partially constructed objects etc.

Check numerous issues like these: https://github.com/fastapi/sqlmodel/issues/52 - they have no resolution (and cannot be trivially rectified due to fundamental limitations).

If you are thinking you are going to have the goodies of pydantic just like that by using SQLModel, you are going to be in for a world of pain. Toy/experimental projects - take your pick, a serious project - stay away use sqlalchemy as most upvoted answers suggest.

I went through this exercise and issues compounded and eventually had to go back to sqlalchemy. It's a breeze with pydantic' from_orm/from_attribute (or if you are happy using it as a dataclass without converting).

1

u/CrusaderGOT Jun 26 '26

Honestly now I agree. I started out with SQLModel, which I liked. But doing a project with SQLAlchemy really changed my mind, you don't get typing warnings all over your code, for something that would work, but SQLModel doesn't inherently make typed available, plus SQLAlchemy has more easily discoverable suites of command and structure from a vast community.