by BiteCode_dev · 3y ago · 0 comments
There are ORM with good pros/cons ratios out there. Python has espacially good ones:
- Django comes with a clunky and poor performing one, but it's very well integrated, super practical, productive and has nice ergonomics.
- Peewee gives you an ORM in a small package, which makes writing those little programs a joy when you don't need anything fancy, but feel lazy.
- SQLAlchemy requires a lot more investment, but is very flexible, generates clean SQL and has extremely correct behavior. It also exposes a lower level query builder for when you don't want the OOP paradigm and wish to express idiomatic SQL behavior, but abstracted away with Python.
This becomes a standard engineering decision, where you analyze the ROI.
The thing people are missing is relations. The most important aspect of your application is how data is related to each other. A good ORM makes that easy.
But if you want hierarchy (in Postgres), to_jsonb(…) is your friend.
Why TF would I use json? There's a reason I picked a relational database. Nonsense.
And also such a performance trap.