Repository navigation
feat(format): lay out SQL Server table hints, table samples, table variables, FOR XML, FOR JSON, FOR SYSTEM_TIME and join hints - #59
Merged
Conversation
…riables, FOR XML, FOR JSON, FOR SYSTEM_TIME and join hints Pin SQLQuack 56c7c15e. Its SQL Server parser now reads TABLESAMPLE, WITH (...) table hints, table variables such as @t, FOR XML, FOR JSON and FOR BROWSE, FOR SYSTEM_TIME AS OF and ALL, and join hints such as INNER LOOP JOIN, so format lays these queries out where it left them as written before. 16 T-SQL corpus queries now come out exactly as the corpus records them. FOR SYSTEM_TIME FROM ... TO, BETWEEN and CONTAINED IN with column bounds are still refused, now with SQL Server's own syntax error. Lowercase LOOP, HASH and NOLOCK hints keep the case they were written in, and the T-SQL statement splitter refuses statements SQL Server rejects.
Deploying sqlclean with
|
| Latest commit: |
2d0b174
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://d3258a06.sqlclean.pages.dev |
| Branch Preview URL: | https://feat-sqlserver-format-sqlqua.sqlclean.pages.dev |
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.
Why
SQLQuack main 56c7c15e (the analysis speed set plus native SQL Server syntax) is the rev SQLBuild's cutover pins. Its SQL Server parser now reads clauses it used to keep as opaque text, so SQLClean can lay those T-SQL queries out instead of leaving them as written.
Changes
rev = "56c7c15ecafe61ea6650159469234db670dea8da". The pin uses the full SHA, not a tag, matching SQLBuild's.formatnow lays out T-SQL queries with:WITH (...)table hints@tINNER LOOP JOINsqlquack_departures.json: the 16 T-SQL departures for those queries are removed, because each now matches the corpus layout exactly. The reason text of the 3 FOR SYSTEM_TIME refusals is updated.Verification
cargo test --all --locked: 48 passed, 0 failed.cargo fmt --checkpasses.uv run pytest tests: 72 passed, with the native package rebuilt from this branch.format tsqllines differ (16 queries now formatted at both widths, plus 3 changed refusal reasons). Everything else is byte-identical.