Debugger is fun and stuff but sometimes it's just faster to dump Django ORM data to a JSON, skim through it, apply fixes and forget about the topic.

Here's how to do that programmatically, e.g. during TestCase execution.

#Django #Python #programming #DailyPythonista #TDD

https://borutzki.github.io/2026/01/25/how-to-dump-django-orm-data-to-json-while-debugging.html

@borutzki That's such a good idea. Often I'll set a breakpoint and poke around in the ephemeral tables in TablePlus but then I've lost the data for comparison between runs!

@internetross this is one of the reasons I needed to introduce such simplistic database dump!

With ability to compare tables across two test runs, you can also debug faster e.g. using LLM to compare the JSONs (if they’re big enough) or do some quick diff! 👌