Last active
May 16, 2025 10:24
-
-
Save rixx/e64a074445ec8adb7ddf18d35c06e6a5 to your computer and use it in GitHub Desktop.
Revisions
-
rixx revised this gist
May 16, 2025 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,10 +2,9 @@ # @breakpoint_on_query() # Or use as `with breakpoint_on_query():` from contextlib import contextmanager @contextmanager def breakpoint_on_query(): from django.db import connection def instrument(execute, sql, params, many, context): # Optional: match only specific queries, e.g. -
rixx created this gist
May 14, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ # Use: wrap methods: # @breakpoint_on_query() # Or use as `with breakpoint_on_query():` @contextmanager def breakpoint_on_query(): from contextlib import contextmanager from django.db import connection def instrument(execute, sql, params, many, context): # Optional: match only specific queries, e.g. # if sql.startswith("DELETE"), or "foo_table" in sql breakpoint() return execute(sql, params, many, context) with connection.execute_wrapper(instrument): yield