News for hackers. Stuff that matters.

mireq

Re:To ORM or Not to ORM on Tuesday May 07, 2019 @01:45PM (#19851709)
I am very happy with ORM.

I'm currently working on an e-shop. I need to display many tables with different filters.

Administrator wants products starting with string? OK: if filter['category']: qs = qs.filter ... Administrator wants products without category? Ok: if filter['category']: qs = qs.filter ... Add multilang supprt? Ok: subclass model, mark fields and translatable, run migrate script

I can combine any filters, ORM automatically creats query with necessary joins, subqueries, group by expressions etc.

If i didn't use ORM i would have to write code that generate select with cca 200 ifs because almost every filter can generate join or add fields to group by or generate subselect etc.

Total score 289 with Thinkpad T420 (148 Points, 141 Bonus) with settings hard / small.