Repository navigation
feat: lay converted DuckDB SQL out one clause per line - #124
Merged
Merged
Conversation
The Translate stage's SQL block uses white-space: pre with horizontal scroll, so a clause-per-line layout shows as laid out. Diagnostics keep wrapping. A stage is a grid item, so it takes min-width: 0; without it, a long line widened the whole page.
Converted statements print each clause on its own line, select items and common table expressions one per line, queries indented by depth and long CASE expressions broken at WHEN, ELSE and END. Short ones stay on one line. Only whitespace between tokens changes. convert --compact keeps the single line, in --json too. Verify replays the laid-out SQL beside the single line and fails a case whose results differ, whose tokens differ, or whose layout is not idempotent.
The playground engine takes a compact setting like convert --compact, and the docs pages that print convert output show the laid-out form.
# Conflicts: # tests/unit/python/src/sqlquack/api/main/test_convert.py
Contributor
Author
|
Gate at ff9ff20 (main cce77ac merged in):
|
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
Converted DuckDB SQL printed as one long line, which reads badly in the playground and in
convertoutput. This is a simple layout until a full formatter replaces it after launch.Changes
layout_sql(sqlquack-duckdb) changes only the whitespace between tokens:convert's text output, the Python API (Conversion.sql) and the playground.convert --compact,ConvertOptions(compact=True)and the playground'scompactsetting keep the single line.--json'ssqlcarries what the text output prints: laid out, or on one line with--compact.<pre>that keeps its lines and scrolls sideways. That change is the website lane's 40efa91.Verification
verifynow checks every converted case:--json,--compactand--compact --json. A Python test coverscompact=Trueagainst the command line.make check-ci,make test-rust,make verify-recorded.