Comment by NeutralForest

14 hours ago

I don't like SQLModel for the simple reason that it muddles boundaries between different parts of the application. I suppose when you have a pure CRUD app it's ok, but anytime you want to handle ORM objects and apply some business logic; you'll want to cleanly separate those from what you send and receive from your API.

Right. I have to wonder how often people are building "APIs" that are just direct CRUD interfaces to SQL DBs. SQLModel seems like taking DRY too seriously. I get it, SQLAlchemy models and Pydantic models look very similar, but they are doing completely different things. SQLModel is just causing you more work later that could have been avoided by just copy/pasting the SQLAlchemy models to Pydantic in the first place.

But even then you'll get people implementing business logic in Pydantic validators. I feel like basic layered architecture is being forgotten.