Database Setup
SQLsaber supports PostgreSQL, MySQL, SQLite, DuckDB, and CSV data sources. This guide covers all the ways to configure database connections.
Supported Database Types
Section titled “Supported Database Types”- PostgreSQL - Full support with SSL
- MySQL - Full support with SSL
- SQLite - Local database files
- DuckDB - Local DuckDB files or in-memory analytics
- CSV - Local CSV files
Adding Database
Section titled “Adding Database”saber db add my-database
This will prompt you for all necessary connection details.
Connection Strings
Section titled “Connection Strings”SQLsaber supports direct connection strings for PostgreSQL and MySQL, plus file URIs for SQLite and DuckDB.
saber -d "postgresql://user:password@localhost:5432/database"
saber -d "mysql://user:password@localhost:3306/database"
saber -d "duckdb:///path/to/data.duckdb"
SQLite
Section titled “SQLite”# Use SQLite file directlysaber -d "./data/sales.db" "Show me total sales by month"
# Relative paths work toosaber -d "~/Documents/mydata.db" "Count all records"
DuckDB
Section titled “DuckDB”# Query a DuckDB filesaber -d "./warehouse/data.duckdb" "Show the latest partition"
# Use an absolute pathsaber -d "duckdb:///Users/me/analytics.duckdb" "Describe orders"
SQLsaber can also analyze CSV files directly.
saber -d "./customers.csv" "How many customers are from each state?"
Managing Connections
Section titled “Managing Connections”List All Connections
Section titled “List All Connections”saber db list
Set Default Database
Section titled “Set Default Database”If you have multiple databases, set one as default:
saber db set-default my-database
Test Connections
Section titled “Test Connections”Verify that a database connection works:
saber db test my-database
Remove Connections
Section titled “Remove Connections”saber db remove my-database
Security
Section titled “Security”Read-only Access
Section titled “Read-only Access”If you are using SQLsaber with a production database, we recommend setting up a read-only role for your database and using those credentials to setup connection in SQLsaber.
While SQLsaber ensures, via checks before executing queries, that only read queries are executed and in our testing have observed that LLMs follow the system prompt of only generating read queries, there is no guarantee that this is fool-proof.
Password Storage
Section titled “Password Storage”SQLsaber stores database passwords securely using your operating system’s credentials store.
SSL Certificates
Section titled “SSL Certificates”Store SSL certificates in a secure location and use absolute paths when configuring connections.
Troubleshooting
Section titled “Troubleshooting”Always test new connections after adding them.
# Test the connectionsaber db test my-database
# If connection fails, check the detailssaber db list
# Update connection if neededsaber db remove my-databasesaber db add my-database # Start over with correct details
Getting Help
Section titled “Getting Help”Use the help commands for more information:
saber db --helpsaber db add --help
What’s Next?
Section titled “What’s Next?”After setting up your database connections:
- Configure authentication for AI providers
- Start querying your data
- Set up memory for better context
- Manage conversation threads