- CLI Reference
- Commands
- ironflow sql
ironflow sql
Execute a read-only SQL query against the Ironflow database.
ironflow sql <query> [flags]Queries are automatically scoped to the current environment. Only SELECT statements are allowed. Mutation keywords (INSERT, UPDATE, DELETE, DROP, etc.) are rejected.
Arguments:
| Argument | Required | Description |
|---|---|---|
query | Yes | SQL SELECT query to execute |
Flags:
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--format | string | table | Output format: table, json, csv, jsonl | |
--timeout | int | 5000 | Query timeout in milliseconds | |
--max-rows | int | 1000 | Maximum rows to return | |
--server | -s | string | Server URL override |
Available tables: events, runs, steps, functions, projection_registry, projection_state
Environment scoping: Queries are automatically filtered to the current environment via temporary views. The environment is determined by the IRONFLOW_ENV env var, or defaults to default.
Examples:
# Count events by nameironflow sql "SELECT name, COUNT(*) AS total FROM events GROUP BY name"
# Find failed runsironflow sql "SELECT id, status FROM runs WHERE status = 'failed' LIMIT 10"
# Export events as JSONironflow sql "SELECT * FROM events WHERE entity_id = 'order-123'" --format json
# CSV output for spreadsheetsironflow sql "SELECT id, name FROM functions" --format csv
# JSONL for streaming processingironflow sql "SELECT * FROM events" --format jsonl | jq '.name'Output (table):
id name entity_idevt_001 order.placed order-123evt_002 order.paid order-123