Running Queries
SQLsaber offers multiple ways to query your database using natural language. This guide covers all the different query modes and their use cases.
Interactive Mode
Section titled “Interactive Mode”Ideal for back and forth conversations about your data.
saber
Single Query Mode
Section titled “Single Query Mode”Run a one-off query without entering interactive mode:
saber "How many orders were placed last week?"
Useful for:
- Shell scripting
- Quick checks
- Automated reporting
Stdin Mode
Section titled “Stdin Mode”Pipe queries from other commands or files:
# From echoecho "Count all active customers from last week" | saber
# From filecat query.txt | saber
# From other commandscurl -s https://api.example.com/query | saber
Useful for:
- Shell scripting
- Batch processing
- Integration with other tools
- Automation
Features
Section titled “Features”Slash Commands
Section titled “Slash Commands”Special commands in interactive mode:
/clear
- Clear conversation history/exit
or/quit
- Exit SQLsaber/thinking on
- Enable extended thinking mode/thinking off
- Disable extended thinking mode
> /clearConversation history cleared.
> /thinking on✓ Thinking enabled
> /exitGoodbye!
Table Autocomplete
Section titled “Table Autocomplete”Type @
followed by a table name to get autocomplete suggestions:
> Show me all records from @cus[TAB]> Show me all records from @customers
Supports schema-aware completions:
> @pub[TAB] → @public.customers
Extended Thinking Mode
Section titled “Extended Thinking Mode”For complex queries requiring deeper reasoning, enable thinking mode to see step-by-step problem solving process.
In interactive mode:
> /thinking on✓ Thinking enabled
> Analyze sales trends and forecast next quarter💭 Thinking...[dim reasoning process appears here][followed by final answer]
> /thinking off✓ Thinking disabled
For single queries:
# Enable thinking for complex analysissaber --thinking "Compare performance across regions with seasonal adjustments"
# Disable for simple queriessaber --no-thinking "How many users do we have?"
Default configuration:
Thinking is disabled by default. To change this, edit ~/.config/sqlsaber/model_config.json
:
{ "model": "anthropic:claude-sonnet-4-20250514", "thinking_enabled": true}
Database Selection
Section titled “Database Selection”Using Default
Section titled “Using Default”If you have a default database configured:
saber "Show me sales data"
Specifying Database by Name
Section titled “Specifying Database by Name”Use a configured database connection:
saber -d prod-db "What's our revenue this month?"
Using Files Directly
Section titled “Using Files Directly”Work with SQLite, DuckDB, or CSV files directly:
# SQLite filesaber -d "./data/sales.db" "Top selling products"
# DuckDB filesaber -d "./data/warehouse.duckdb" "Latest partitions"
# CSV filesaber -d "./customers.csv" "How many customers per state?"
Connection Strings
Section titled “Connection Strings”Use connection strings for temporary connections:
saber -d "postgresql://user:pass@host:5432/db" "Count all users"
Connection Issues
Section titled “Connection Issues”# Test the connectionsaber db test my-database
# Check database listsaber db list
What’s Next?
Section titled “What’s Next?”Now that you know how to query effectively: