Skip to content

Add SQL output format option#5459

Merged
clockwork-labs-bot merged 2 commits into
masterfrom
bot/sql-format-option
Jun 30, 2026
Merged

Add SQL output format option#5459
clockwork-labs-bot merged 2 commits into
masterfrom
bot/sql-format-option

Conversation

@clockwork-labs-bot

@clockwork-labs-bot clockwork-labs-bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Adds --format to spacetime sql, matching spacetime logs with text as the default and json as the raw API response output. The REPL path passes the selected format through to each query while preserving the existing text output and stats behavior by default.

Closes #5450.

API and ABI breaking changes

None.

Expected complexity level and risk

  1. Small CLI-only output option. Default behavior is unchanged.

Testing

  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH /Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/rustfmt --check crates/cli/src/subcommands/sql.rs crates/cli/src/subcommands/repl.rs
  • git diff --check
  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH /Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo check -p spacetimedb-cli
  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH /Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo test -p spacetimedb-cli subcommands::sql::tests:: -- --nocapture
  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH /Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo run -p spacetimedb-cli -- sql --help
  • PATH=/Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin:$PATH /Users/clockworklabs/.rustup/toolchains/1.93.0-aarch64-apple-darwin/bin/cargo ci self-docs --check

Note: cargo ci self-docs --check printed the existing warning argument dotnet is missing help text.

Note: cargo fmt --all --check could not be run in this shell because the installed cargo toolchains do not expose cargo-fmt; rustfmt --check was run directly on the touched Rust files instead.

@bfops bfops left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work as expected for me, with both

cargo run -pspacetimedb-cli -- sql -s maincloud --format=json spacetime-control

and

cargo run -pspacetimedb-cli -- sql -s maincloud --format=json spacetime-control --interactive

@bfops bfops enabled auto-merge June 29, 2026 17:44
@bfops bfops disabled auto-merge June 29, 2026 17:55
@bfops bfops self-assigned this Jun 29, 2026
@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Jun 30, 2026
Merged via the queue into master with commit 03e1b13 Jun 30, 2026
36 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.

spacetime sql and spacetime logs currently lack machine readable output format (--format json|csv)

2 participants