Taming the beast that is the Django ORM – An introduction
31–40 of 144 posts
Re: Taming the beast that is the Django ORM – An introduction
#32I adore the Django ORM but as listed under cons... it makes it very hard to avoid accidental N+1 queries, and they don't seem interested in addressing this ( https://code.djangoproject.com/ticket/30874 ). Yes lazy loading is neat when you're messing around on the shell, but you should absolutely not be leaning on it in production at any kind of scale. So instead you have to use unit tests to hopefully catch any N+1 q…
Re: Taming the beast that is the Django ORM – An introduction
#33Re: Taming the beast that is the Django ORM – An introduction
#34I adore the Django ORM but as listed under cons... it makes it very hard to avoid accidental N+1 queries, and they don't seem interested in addressing this ( https://code.djangoproject.com/ticket/30874 ). Yes lazy loading is neat when you're messing around on the shell, but you should absolutely not be leaning on it in production at any kind of scale. So instead you have to use unit tests to hopefully catch any N+1 q…
What would be the best way?
Re: Taming the beast that is the Django ORM – An introduction
#35I adore the Django ORM but as listed under cons... it makes it very hard to avoid accidental N+1 queries, and they don't seem interested in addressing this ( https://code.djangoproject.com/ticket/30874 ). Yes lazy loading is neat when you're messing around on the shell, but you should absolutely not be leaning on it in production at any kind of scale. So instead you have to use unit tests to hopefully catch any N+1 q…
I use https://pypi.org/project/django-nplusone/ for instance. Sentry also warns of these by the way.
Re: Taming the beast that is the Django ORM – An introduction
#36For me the killer feature of django is the auto-generated admin UI. I initially started my last project using Spring boot, but I was astonished to find there was no equivalent. I don't know how people build websites in any speed without such a tool. I guess they just waste time duplicating effort on an admin UI or pay for one of those tools that can generate one from an API (meaning they have to also build an API). I…
Re: Taming the beast that is the Django ORM – An introduction
#37For me the killer feature of django is the auto-generated admin UI. I initially started my last project using Spring boot, but I was astonished to find there was no equivalent. I don't know how people build websites in any speed without such a tool. I guess they just waste time duplicating effort on an admin UI or pay for one of those tools that can generate one from an API (meaning they have to also build an API). I…
- the main reason to use django today is the admin UI
- and the only reason to use django ORM is the admin UI
Re: Taming the beast that is the Django ORM – An introduction
#38Earlier quoted context omitted.
What would be the best way?
If it were up to me there'd be a way to completely disable it globally for all models. Let me explicitly enable it when I'm just shelling around or checking results in unit tests. It is not a feature for production environments.
Re: Taming the beast that is the Django ORM – An introduction
#39ORMs do a great job at making easy things even easier and hard things a lot harder. If that sounds like a bad deal to you- it’s because it is!