Repository navigation
Add native SQL formatting with rtree format - #82
Merged
Merged
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.
Add
rtree formatto format complete SQL throughPOST /v1/query-formatwithout executing SQL. Bothrtree queryandrtree formataccept positional SQL,--sql,--query, and-q. Omitted SQL or-reads stdin, including shell file redirection andcatpipes. Supplying multiple SQL arguments is rejected.Explicit stdin also works as a positional
-,--sql -,--query -, or-q -for both commands.Formatting preserves the complete response byte for byte;
--jsonreturns{ "formatted": "..." }. Organization, cluster, and optional database use existing scope resolution. The shared stdin reader preserves whitespace. Formatting allows 120 seconds for the complete HTTP request; the API retains its 30-second formatting timeout, 50 MiB JSON input limit, and 100 MiB output limit. Multiple statements and literals are preserved, including inline INSERT VALUES payloads without completeness/schema validation. Errors emit no partial formatted SQL.Bump CLI 0.6.14 → 0.6.15 in Cargo.toml and Cargo.lock.
Dependency: Platform #1468, inspected at
397dc652846ad5820073641c19301ea154289cce. The formatting endpoint must be deployed before this command can be used.Validation:
cargo fmt --all -- --check;cargo test --locked: 208 passed, six existing real-Platform tests skipped locally.cargo clippy --all-targets --locked: succeeded with pre-existing warnings.catpipes with implicit stdin and every explicit-form. SQL bytes, endpoints, scope, output, and generated help verified.--mode local --max-priority P3) and thermo-nuclear maintainability review: no actionable findings. TruffleHog clean.Companion: MCP #32.
Note
Low Risk
CLI-only feature and input UX changes with mock integration tests; depends on a new platform endpoint but does not alter auth or query execution paths beyond shared SQL resolution.
Overview
Adds
rtree formatto pretty-print SQL viaPOST /v1/query-format(optional database scope), with plain stdout or--json, and a 120s HTTP timeout so upload/download does not eat the server’s formatting budget.queryandformatnow share richer SQL input:--sql/--query/-q, implicit or explicit stdin (-), and stdin content is sent without trimming so whitespace is preserved. The API client exposespost_with_timeoutfor configurable request deadlines.Docs cover the new command and limits; integration tests exercise format, stdin, scopes, and errors. Version 0.6.14 → 0.6.15 (requires Platform
/v1/query-format).Reviewed by Cursor Bugbot for commit aadb16f. Bugbot is set up for automated code reviews on this repo. Configure here.