Repository navigation
fix: pin SQLQuack 804864d2 and format CTE-body placeholders - #44
Merged
Merged
Conversation
A host writes one interpolation placeholder for a macro that expands to a whole query, as in `headers AS (__sqlclean_interpolation_6__)`. SQLQuack cannot parse a bare name as a query, so the file was declined. The formatter now writes `SELECT ` before such a placeholder, lays the SQL out, and takes the `SELECT` back out, checking that every token is unchanged. A SELECT the author wrote before a placeholder is kept.
Every SQLQuack crate moves to the same rev the SQLBuild cutover pins, so a build that uses both has one copy of SQLQuack. SQLQuack now fingerprints SQL Server with its own tokenizer, so a bracketed name such as `[o]` is one token. The fingerprint of a SQL Server query with bracketed names changes once from SQLClean 0.5.0 and 0.6.0, back to the value SQLBuild 0.204.0 stores: the golden row moves from f1525ee2 to f4fac3ed. Every other golden fingerprint is unchanged.
Deploying sqlclean with
|
| Latest commit: |
b55cb1b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0e8f2e53.sqlclean.pages.dev |
| Branch Preview URL: | https://fix-sqlquack-804864d2.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
SQLBuild's cutover pins SQLQuack 804864d2. SQLClean must pin the same rev, or a build using both gets two copies of SQLQuack. That rev also brings formatter fixes, and DuckShop needs SQLClean to format a placeholder that stands for a whole CTE query.
Changes
AS (<placeholder>)CTE bodies: writeSELECTbefore the placeholder, lay out, take it out again, and check every token.[o]now being one token, from f1525ee2 to f4fac3ed, which SQLBuild 0.204.0 stores for that row. It is the only golden row that changed: the BigQuery, Snowflake, DuckDB, PostgreSQL, Databricks and generic rows are identical. (BigQuery's golden statement happens to hash the same; other BigQuery statements change.)Verification
make verify: fensu 0 faults; cargo 40 + 8 passed; pytest 72 passed.@pyCTE bodies.BEGIN_COMMIT_OVERRIDE
fix(format): lay out a placeholder that stands for a CTE's whole query
fix(format): lay out T-SQL variable assignments, named EXEC arguments and DECLARE defaults
fix(format): lay out Snowflake paths after a qualified column spelled like a keyword, such as
s.body:tsfix: fingerprint BigQuery and SQL Server with their own tokenizers, so keyword case no longer changes them; their fingerprints change once
build(deps): pin SQLQuack 804864d2
END_COMMIT_OVERRIDE