-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Discard semicolon stripping in SQL hook #25855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,16 +24,13 @@ | |
| "line,parsed_statements", | ||
| [ | ||
| ('SELECT * FROM table', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table;', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table; # comment', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table; # comment;', ['SELECT * FROM table']), | ||
| (' SELECT * FROM table ; # comment;', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table;;;;;', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table;;# comment;;;', ['SELECT * FROM table']), | ||
| ('SELECT * FROM table;;# comment;; ;', ['SELECT * FROM table']), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did I remove these test cases? In the previous PR, some functionality was added that tried to make SQL query clearer. |
||
| ('SELECT * FROM table;', ['SELECT * FROM table;']), | ||
| ('SELECT * FROM table; # comment', ['SELECT * FROM table;']), | ||
| ('SELECT * FROM table; # comment;', ['SELECT * FROM table;']), | ||
| (' SELECT * FROM table ; # comment;', ['SELECT * FROM table ;']), | ||
| ( | ||
| 'SELECT * FROM table; SELECT * FROM table2 # comment', | ||
| ['SELECT * FROM table', 'SELECT * FROM table2'], | ||
| ['SELECT * FROM table;', 'SELECT * FROM table2'], | ||
| ), | ||
| ], | ||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
sqlparse.splitalready has.strip:return [str(stmt).strip() for stmt in stack.run(sql, encoding)]There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this filtration is necessary I think: