Repository navigation
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.
Fixes #550.
With
reindent=True, a date scalar with an explicit alias splits the SELECTprojection list. For example,
SELECT 'value 1' AS VALUE_1, CURRENT_DATE AS CREATED_AT, 'testing' AS VALUE_2, 'testing2' AS VALUE_3 FROM TABLE_1indents the last two columns by 23 spaces instead of 7.
Allow
CURRENT_DATE,CURRENT_TIME, andCURRENT_TIMESTAMPin the existingexplicit-AS grouping rule, alongside
NULL. This keeps each scalar with itsalias, restores column alignment, and makes
get_alias()returnCREATED_AT.Other keyword handling and implicit aliases are unchanged.
Tests cover all three scalars in upper/lower/mixed case, ordinary-column and
NULL controls, exact parsing round trips including whitespace, projection
boundaries, alias discovery, and repeated formatting. The reported trailing
comma is covered separately for preservation; the main regression uses valid SQL.
Validation on Windows / Python 3.11.17:
implementation; all 25 pass with this change.
uv run --group dev --python 3.11 pytest tests/test_grouping.py tests/test_format.py:190 passed, 2 xfailed.
uv run --group dev --python 3.11 pytest tests/:531 passed, 2 xfailed, 1 xpassed. The xfail/xpass outcomes match unchanged
upstream (506 passed, 2 xfailed, 1 xpassed).
uv run --group dev ruff check sqlparse/andgit diff --checkpass.Developed with AI assistance and independently reviewed by another agent, which
also reran the checks above. Other Python versions/platforms were not tested
locally for the complete suite.
pytest)ruff)