Don't use 'literal_binds' in executed SQL — it's a debugging option - #9505
Open
bluepython508 wants to merge 3 commits into
Open
bluepython508 wants to merge 3 commits into
bluepython508 wants to merge 3 commits into
Conversation
caiotheodoro
left a comment
There was a problem hiding this comment.
File doesn't parse as-is (indentation is broken from inline_sql_parameters onward), which is why 19/21 checks are failing. One design concern once that's fixed, inline.
| return len(pglast.parser.parse_sql(sql)) == 1 | ||
| except pglast.parser.ParseError: | ||
| return False | ||
| def inline_sql_parameters(sql: str, params: dict) -> str: |
There was a problem hiding this comment.
bug: mixed leading whitespace from here through is_single_statement - ruff reports invalid-syntax: unindent does not match any outer indentation level starting at this line. This is the whole reason Ruff/PyRight/pytest/Cypress are all red, not a real regression in the approach.
| if not is_single_statement(sql_string, params): | ||
| clause = inline_sql_parameters(sql_string, params) | ||
|
|
||
| if not is_single_statement(clause): |
This comment was marked as duplicate.
This comment was marked as duplicate.
Sorry, something went wrong.
This branch has not been deployed
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.
literal_bindsis documented as generally being for logging or debugging purposes, and the result shouldn't be passed to databases.We can use psycopg2's provided mechanism to do this.