Skip to content

fix: read SQL with SQLBabel 0.39.0 and keep held Databricks forms as written - #109

Merged
kvlonge merged 4 commits into
mainfrom
feat/sqlbabel-parser
Nov 30, 2026
Merged

kvlonge merged 4 commits into
mainfrom
feat/sqlbabel-parser

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Why

SQLClean reads SQL with SQLQuack's parsers, which are now released as SQLBabel. SQLBabel 0.39.0 reads six Databricks forms as trees but holds them from layout until it reviews them: alter_column, alter_connection, create_function, create_sql_function, insert_overwrite_directory_hive and query_tags. Read through the reviewed parser, those statements would become parse errors, and fixing or formatting them could rewrite layout SQLBabel has not checked.

Changes

  • The parser crates are built from the SQLBabel v0.39.0 tag, with every SQLQuack name moved to SQLBabel.
  • Lint reads held statements from their tree, so they give the same findings as before. Those findings carry no fix, from built-in or custom Rules.
  • fix and format leave each held statement byte for byte as written and still fix and format the rest of the file.
  • check gives one note per held statement in text, JSON (held, summary.held) and SARIF (a note notification); format prints it on stderr. A note never changes the exit code.
  • Databricks lint corpus: 7 SQLCLEAN022 spans are corrected (Spark has no '' escape) and 3 DEFERRABLE constraints now parse; the 14 held queries match 0.12.2.
  • Docs: the configuration, check, fix and format pages, and the regenerated skill references.

Release note: no fixes on the six held Databricks forms until SQLBabel reviews their layout.

Verification

  • cargo test --workspace, cargo clippy --all-targets -- -D warnings, cargo fmt --check, fensu check, ruff, ty and the docs-skill check pass.
  • New unit tests cover held lists, stripped fixes, a held statement with a CTE between fixable statements and multibyte text; new e2e cases cover check, format and fix --unsafe-fixes byte identity. The Python suite passes (99 tests).
  • An independent review probed all six forms, duplicates, comments, cache and selection, and exit codes, and found no correctness problems.

Not ready: pinned to sqlbabel main (b1fe6f3c), not the v0.39.0 tag; the lint corpus changes
on 24 Databricks queries and is not accepted. Checked locally: every other Rust test passes.
SQLBabel reads six Databricks forms as trees but holds them from layout
until it reviews them: alter_column, alter_connection, create_function,
create_sql_function, insert_overwrite_directory_hive and query_tags.
Lint now reads these statements from their tree, so they give the same
findings as before instead of a parse error, but those findings carry no
fix. fix and format leave each such statement byte for byte as written,
and check, format, JSON and SARIF output give one note per statement.
The note never fails a command.

Release note: no fixes on the six held Databricks forms until SQLBabel
reviews their layout.
@kvlonge
kvlonge merged commit c73cf23 into main Nov 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant