Repository navigation
Fix debug SQL tracking for composed queries - #1566
Open
2836048681 wants to merge 1 commit into
Open
2836048681 wants to merge 1 commit into
2836048681 wants to merge 1 commit into
Conversation
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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
graphql-python/graphene-djangomainat0e6ef22fix/960-debug-sql-non-stringatfa985ddSummary
Passing a
psycopg2.sql.Composedquery tocursor.execute()succeeds at the driver but raisesAttributeErrorinDjangoDebugMiddlewarewhen the middleware calls.lower()on the query object. Use the SQL text returned by Django’s backend to classify non-string queries. If the backend has no SQL text, record the query as having no detectedSELECT.Fixes #960
Testing
psycopg2.sql.Composedobjects and mock the cursor and backend, so no PostgreSQL server is needed.python -m pytest --cov=graphene_django graphene_django examples -q --tb=shortpassed all 407 tests on Python 3.12.3 with Django 5.2.19 and psycopg2-binary 2.9.13.ruff check graphene_django examples, Ruff formatting on the two changed files, andgit diff --checkpassed.Fixes #960.