# Query Assertions for Django ![Latest Release](https://img.shields.io/pypi/v/django-assert-queries) ![License](https://img.shields.io/badge/license-MIT-green.svg) ![Review Board](https://img.shields.io/badge/Review%20Board-d0e6ff?label=reviewed%20with) ![Python](https://img.shields.io/pypi/pyversions/django-assert-queries) **GitHub:** https://github.com/beanbaginc/django-assert-queries **PyPI:** https://pypi.org/project/django-assert-queries **Status:** Under active development / released / used in production ORMs. Love 'em or hate 'em, they're often part of the job, and a core part of writing [Django](https://djangoproject.com) webapps. They can make it easy to write queries that work across databases, but the trade-off is your queries might explode in number and in complexity. Who hasn't made this mistake? ```python for book in Book.objects.all(): print(f'Author: {book.author.name}') ``` Spot the error? We're fetching the associated author once for every book. For 100 books, that's 101 queries! And that's just a really basic query. These mistakes happen all the time, and they're not always easy to catch in unit tests. That's what the clear-but-unimaginatively-named [django-assert-queries](https://pypi.org/project/django-assert-queries) is here to solve. With proper use, this can save companies from costly mistakes. [We've](https://www.reviewboard.org) found it to be an invaluable tool in our arsenal.