Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's possible with the ORM, but much more complicated than the SQL you intend to get:

AppComment.objects.annotate(content_len=Length('content')).all().aggregate(Sum('content_len'))

https://docs.djangoproject.com/en/1.9/ref/models/expressions...



`.all()` is completely redundant (it just clones the queryset).


What is the generated SQL?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: