sentier-dev / glossary-api

Sustainability assessment classifications glossary
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Switch to `SQLModel` #33

Open sami-m-g opened 1 month ago

jsvgoncalves commented 1 month ago

@sami-m-g I'm removing this from backlog and current iteration, as per previous slack discussions from @cmutel:

Maybe - not sure I would use the word "should" yet. Duplication isn't great, but I personally am worried about getting too deep into the FastAPI stack and there being magic floating around that could bite us later. But that's just one opinion - the point is that we should make this decision together, and with an informed sense of costs and benefits.

sami-m-g commented 1 month ago

@jsvgoncalves SQLModel is built as a layer on top of SQLAlchemy offering the convenient of having your models as both SQLAlchemy and PyDantic models. Most of our code would simply work out of the box by switching to it while cutting our code base by a third. With the movement to the separation of dto, data and API, not using SQLModel would really increase our codebase more. I highly suggest the movement which has minimal cost with great ROI. For starters it will remove all the to_dict methods and keep one model for database and schema while offering off the shelf functionalities that otherwise we will have to implement like __eq__. The movement would be done in a day of work.