Skip to main content
Version: 0.4

CLI Reference

The rosql CLI requires the server feature flag.

Install:

curl -fsSL https://rosql.org/install.sh | sh

Linux x86_64 / arm64 · macOS Intel & Apple Silicon.

Commands

rosql parse

Parse a ROSQL query and output the AST as JSON.

rosql parse "FROM traces WHERE duration > 500 ms SINCE 1 hour ago"

Flags:

  • --file <path> — read query from a file instead of a positional argument

rosql compile

Compile a ROSQL query to SQL. No database connection required.

rosql compile "FROM traces WHERE duration > 500 ms" --backend postgres
SELECT * FROM otel_traces
WHERE duration > 500000000
ORDER BY timestamp DESC
LIMIT 100

Flags:

  • --backend — target SQL dialect: postgres, mysql, parquet (required; env: ROSQL_BACKEND)
  • --schema — column naming profile: otel-postgres (default), otel-clickhouse (env: ROSQL_SCHEMA)
  • --file <path> — read query from a file

rosql query

Execute a ROSQL query and return results.

rosql query "FROM traces WHERE status = 'ERROR'" \
--backend postgres \
--url postgresql://user:pass@localhost:5432/db

Output defaults to a human-readable table. Use --format json for scripts.

Flags:

  • --backend — driver: postgres, mysql, parquet (env: ROSQL_BACKEND)
  • --url — database connection string (env: ROSQL_URL)
  • --schema — column naming profile (env: ROSQL_SCHEMA)
  • --format — output format: table (default), json, csv
  • --no-color — disable ANSI color codes
  • --file <path> — read query from a file

If --backend or --url are omitted, they are read from ROSQL_BACKEND / ROSQL_URL environment variables or ~/.config/rosql/config.toml.


rosql schema

Inspect which canonical data sources are available on the connected backend.

rosql schema --backend parquet --url ./telemetry/
╭─────────────┬──────────────────┬───────────────╮
│ Source │ Table │ Status │
├─────────────┼──────────────────┼───────────────┤
│ traces │ otel_traces │ available │
│ logs │ otel_logs │ available │
│ metrics │ otel_metrics │ not found │
│ topics │ topic_messages │ available │
│ recordings │ mcap_metadata │ not found │
╰─────────────┴──────────────────┴───────────────╯

Flags:

  • --backend — driver (env: ROSQL_BACKEND)
  • --url — connection string (env: ROSQL_URL)
  • --formattable (default), json, csv
  • --no-color — disable color

rosql validate

Validate ROSQL query syntax. Exits with code 0 if valid, 1 if invalid.

rosql validate "SELECT * FROM logs"
# exit 0 — valid

rosql validate "INSERT INTO logs"
# exit 1 — invalid: INSERT not supported

Flags:

  • --file <path> — read query from a file

Useful in CI pipelines to validate stored queries.


rosql completions

Get autocomplete suggestions at a given cursor position.

rosql completions "FROM " 5
[
{"label": "logs", "kind": "DataSource"},
{"label": "traces", "kind": "DataSource"},
{"label": "metrics", "kind": "DataSource"},
{"label": "topics", "kind": "DataSource"}
]

Arguments:

  • <query> — partial query string
  • <cursor> — cursor position (byte offset)

rosql serve

Start the gRPC server on a Unix socket. Used by language server integrations and IDE plugins.

# Default socket path
rosql serve --socket /tmp/rosql.sock

# Custom socket path
rosql serve --socket /run/rosql/rosql.sock

The server exposes the ParserService proto interface (defined in proto/rosql/v1/). It accepts:

  • Parse — parse a query
  • Validate — validate syntax
  • GetCompletions — get autocomplete suggestions

Global flags

FlagDescription
--no-colorDisable ANSI color codes for all output. Auto-disabled when stdout is not a TTY.
--helpPrint help for any subcommand.
--versionPrint the installed version.

Config file

~/.config/rosql/config.toml sets default values for --backend, --url, and --schema.

[default]
backend = "postgres"
url = "postgresql://user:pass@localhost:5432/telemetry"
schema = "otel-postgres"

Precedence: CLI flag > ROSQL_* environment variable > config file > built-in default.


Environment variables

VariableEquivalent flagDescription
ROSQL_BACKEND--backendDefault backend for query, schema, compile
ROSQL_URL--urlDefault connection URL for query and schema
ROSQL_SCHEMA--schemaDefault schema profile

Schema profiles

ProfileColumnsExporter
otel-postgres (default)snake_case: trace_id, span_nameOTel Collector PostgreSQL exporter
otel-clickhousePascalCase: TraceId, SpanNameOTel Collector ClickHouse exporter

Pre-built binaries

PlatformArchitectureDownload
Linuxx86_64GitHub Releases
Linuxaarch64GitHub Releases
macOSApple Silicon (aarch64)GitHub Releases
macOSIntel (x86_64)GitHub Releases

Other platforms: build from source (see Quickstart →).