Re:Show HN: Advanced-Alchemy – A framework agnostic library ...
by Kumzy on Wednesday April 23, 2025 @02:14PM
(#43775004)
Hello, OP there, I have many use cases that fall outside of FastAPI or web apps in general, and this pattern allows me to consolidate that logic in a re-usable way.
We also have SQLSpec[1] (Work in progress) that could maybe a better use case for you with raw SQL
Re:Show HN: Advanced-Alchemy – A framework agnostic library ...
by NeutralForest on Wednesday April 23, 2025 @03:02PM
(#43775543)
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.
Re:Show HN: Advanced-Alchemy – A framework agnostic library ...
by globular-toast on Thursday April 24, 2025 @03:19AM
(#43780054)
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.
Re:Show HN: Advanced-Alchemy – A framework agnostic library ...
by zo1 on Wednesday April 23, 2025 @01:16PM
(#43774373)
FastAPI and it's very opinionated "ecosystem" of "easy to use" and "hipster-esque documented" tools are fast-becoming a horrible one-man show version of Django, and we will all regret going so deep into it using it, one day. Until then, sure we can use it and it mostly makes sense and it mostly works really very well. Hopefully the community matures and moves away from opinionated tooling that forces you into the "one true way".
1. https://sqlmodel.tiangolo.com/