Skip to content

Running queries

Ask a question about your data. SQLsaber writes SQL, runs it, and explains the result.

Terminal window
saber

Type /help for slash commands. Type @ and press Tab to complete a table name. The full list is in Commands.

Terminal window
saber "How many orders were placed last week?"

Use this in scripts, for a quick check, or for a one-line report.

Terminal window
echo "Count all active customers from last week" | saber
cat query.txt | saber

If a default connection exists:

Terminal window
saber "Show me sales data"

To use a saved connection by name:

Terminal window
saber -d prod-db "What's our revenue this month?"

To use a local file:

Terminal window
saber -d "./data/sales.db" "Top selling products"
saber -d "./data/warehouse.duckdb" "Latest partitions"
saber -d "./customers.csv" "How many customers per state?"
saber -d "./orders.parquet" "What is total revenue?"

To use a connection string for this run only:

Terminal window
saber -d "postgresql://user:pass@host:5432/db" "Count all users"

A fresh install has thinking on at medium. Raise the level for harder analysis. Turn thinking off when the question is small.

In interactive mode:

> /thinking
Thinking: enabled (medium)
> /thinking high
✓ Thinking: enabled (high)
> Analyze sales trends and forecast next quarter
> /thinking off
✓ Thinking: disabled

For a single query:

Terminal window
saber --thinking "Compare performance across regions with seasonal adjustments"
saber --no-thinking "How many users do we have?"

To save a default level, run saber models set and answer the thinking prompts. Check the saved values with saber models current.

Levels are off, minimal, low, medium, high, and maximum. Each level maps to a provider setting:

  • Anthropic: budget_tokens from 1,024 to 100,000
  • OpenAI: reasoning_effort from minimal to xhigh
  • Google: thinking_level from MINIMAL to HIGH
  • Groq: any non-off level enables reasoning

When the conversation is long, or you want a new direction without losing what you found, run /handoff:

> /handoff optimize the monthly revenue query for better performance

SQLsaber summarizes the conversation, shows an editable draft prompt, ends the current thread, and starts a new one with that prompt.

SQLsaber allows SELECT only unless you pass --allow-dangerous:

Terminal window
saber --allow-dangerous "Insert a new user with email test@example.com"
saber --allow-dangerous

Dangerous mode allows INSERT, UPDATE, and DELETE (UPDATE and DELETE require WHERE), plus CREATE TABLE, CREATE VIEW, CREATE INDEX, and ALTER TABLE.

It still blocks DROP, TRUNCATE, transaction control, GRANT, REVOKE, ATTACH, DETACH, and admin objects such as functions, procedures, triggers, users, roles, and databases.

The full policy is in Commands.

Terminal window
saber db test my-database
saber db list
  1. Resume a conversation
  2. Command reference
  3. Database setup