3 ms·
Yesterday I was wondering if anything like this existed after accidentally adding 100 duplicate database requests on a Django endpoint.
by LiamPa 6y ago
Yesterday I was wondering if anything like this existed after accidentally adding 100 duplicate database requests on a Django endpoint.
- JackC 6y agodjango_assert_num_queries is helpful for this as well -- basically any time I'm writing a test for something where I've spent time thinking about query efficiency in the first place, I'll throw in an assert. (I actually use a homerolled version that can log the location of the queries with -v, but same idea.) https://pytest-django.readthedocs.io/en/latest/helpers.html#django-assert-num-queries https://pytest-django.readthedocs.io/en/latest/helpers.html#...