Skip to content

Commit afe7f69

Browse files
artamonovkirillKirill Artamonov
authored andcommitted
Skip logging queries
Fixes #287 CursorDebugWrapper already adds an entry to the queries_log post-execution: https://github.com/django/django/blob/main/django/db/backends/utils.py#L145-L150
1 parent 871c1c8 commit afe7f69

File tree

1 file changed

+0
-5
lines changed
  • python/sqlcommenter-python/google/cloud/sqlcommenter/django

1 file changed

+0
-5
lines changed

python/sqlcommenter-python/google/cloud/sqlcommenter/django/middleware.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import django
2121
from django.db import connections
22-
from django.db.backends.utils import CursorDebugWrapper
2322
from google.cloud.sqlcommenter import add_sql_comment
2423
from google.cloud.sqlcommenter.opencensus import get_opencensus_values
2524
from google.cloud.sqlcommenter.opentelemetry import get_opentelemetry_values
@@ -90,8 +89,4 @@ def __call__(self, execute, sql, params, many, context):
9089
# * https://github.com/basecamp/marginalia/issues/61
9190
# * https://github.com/basecamp/marginalia/pull/80
9291

93-
# Add the query to the query log if debugging.
94-
if isinstance(context['cursor'], CursorDebugWrapper):
95-
context['connection'].queries_log.append(sql)
96-
9792
return execute(sql, params, many, context)

0 commit comments

Comments
 (0)