3 ms·
I think maybe with Django, you could use a QuerySet with an F expression to do this? [0] Agreed that it's trivial in pure SQL. As a counter though, having worke
by sgarland 3y ago
I think maybe with Django, you could use a QuerySet with an F expression to do this? [0] Agreed that it's trivial in pure SQL. As a counter though, having worked at places using an ORM (mostly Django), and also where everything was raw SQL, the latter winds up having WILDLY inefficient schema and queries that the DB team (me) has to fix later.
I lost any respect for Prisma when I learned it doesn't do JOINs in the DB. [1]
[0]: https://docs.djangoproject.com/en/5.0/ref/models/expressions/#f-expressions https://docs.djangoproject.com/en/5.0/ref/models/expressions...
[1]: https://github.com/prisma/prisma/issues/5184 https://github.com/prisma/prisma/issues/5184
- solatic 3y ago> raw SQL... winds up having WILDLY inefficient schema and queries that the DB team (me) has to fix later. I won't dispute this, I'll just point out that (a) premature optimization is the root of all evil, (b) because it's raw SQL, it's easier to reason about and fix. Inefficient queries aren't really a problem in the early days when your whole dataset doesn't even add up to a gigabyte.
- sgarland 3y agoThe queries aren't necessarily a problem early on (although I've seen OFFSET/LIMIT used for pagination, which is just... no), but schema is sticky. Terrible decisions made early on only become harder to fix as the data set grows.