---
title: "Discussion on \"About CaptureQueriesContext\" | Hashnode"
description: "Discussion on \"About CaptureQueriesContext\". If you ever need to access the raw SQL executed during any unit test, the CaptureQueriesContext context manager can help. It's very simple:\nfrom django.db import connection\nfrom django.test.utils import CaptureQueriesContext\n\ndef test_foo():\n  with C..."
url: "https://hashnode.com/posts/about-capturequeriescontext/61e73cb70204273bdcb0fd81"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [About CaptureQueriesContext](https://til.justinthurman.dev/about-capturequeriescontext?utm_source=hashnode&utm_medium=feed)

If you ever need to access the raw SQL executed during any unit test, the CaptureQueriesContext context manager can help. It's very simple: from django.db import connection from django.test.utils import CaptureQueriesContext def test\_foo(): with C...

Jan 18, 2022 · 1 min read · til.justinthurman.dev  
Read the article

-   [#django](https://hashnode.com/tag/django)
-   [#testing](https://hashnode.com/tag/testing)

## Written by

[Justin Thurman](https://hashnode.com/@justinthurman)

@justinthurman

  
[View profile](https://hashnode.com/@justinthurman)

Software Engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
