Thanks for the quick response Simon. This looks to be very informative. It will take me a while to digest all of it, but I've already gotten logging working for my queries. Very helpful.
Thanks,
Don
On Tue, Jul 23, 2019 at 11:38 AM Simon Charette <charette.s@gmail.com> wrote:
--Hello Don,Django logs all database queries to the django.db.backends logger. It is notredirected to STDOUT when using the default settings.LOGGING configurationbut you can enable it yourself[0].If you wan to assert against a fixed number of queries you can use theassertNumQueries context manager[1] provided by SimpleTestCase and itssubclasses to do that.For an easy to setup and per-view breakdown of the number of queries Isuggest you install the django-debug-toolbar[2] and enable the SQL panel.For more details about optimizing database accesses within a Django projectI suggest you have a look at the dedicated section of the documentation[3].I've filed a ticket to make sure bulk_update is also mentioned in this sectionof the documentation.Cheers,SimonLe mardi 23 juillet 2019 12:19:03 UTC-4, Don Baldwin a écrit :I have a function that runs some database queries and updates. In the test code for that function, I'd like to check out many times the database is actually being hit. Does Django provide a way to get that information?Thanks,Don
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/cywNQX35caw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bf8c2c46-40b7-477a-8635-9da5c766bb7d%40googlegroups.com.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAKL%3DYPGhfZdzFJZG%2BCD0ARQxwjwcG%3DC_fg_YpLeEDmVx47pd2A%40mail.gmail.com.
No comments:
Post a Comment