Skip to content

Database Setup

SQLsaber supports PostgreSQL, MySQL, SQLite, DuckDB, and CSV data sources. This guide covers all the ways to configure database connections.

  • 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
Terminal window
saber db add my-database

This will prompt you for all necessary connection details.

SQLsaber supports direct connection strings for PostgreSQL and MySQL, plus file URIs for SQLite and DuckDB.

Terminal window
saber -d "postgresql://user:password@localhost:5432/database"
saber -d "mysql://user:password@localhost:3306/database"
saber -d "duckdb:///path/to/data.duckdb"
Terminal window
# Use SQLite file directly
saber -d "./data/sales.db" "Show me total sales by month"
# Relative paths work too
saber -d "~/Documents/mydata.db" "Count all records"
Terminal window
# Query a DuckDB file
saber -d "./warehouse/data.duckdb" "Show the latest partition"
# Use an absolute path
saber -d "duckdb:///Users/me/analytics.duckdb" "Describe orders"

SQLsaber can also analyze CSV files directly.

Terminal window
saber -d "./customers.csv" "How many customers are from each state?"
Terminal window
saber db list

If you have multiple databases, set one as default:

Terminal window
saber db set-default my-database

Verify that a database connection works:

Terminal window
saber db test my-database
Terminal window
saber db remove my-database

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.

SQLsaber stores database passwords securely using your operating system’s credentials store.

Store SSL certificates in a secure location and use absolute paths when configuring connections.

Always test new connections after adding them.

Terminal window
# Test the connection
saber db test my-database
# If connection fails, check the details
saber db list
# Update connection if needed
saber db remove my-database
saber db add my-database # Start over with correct details

Use the help commands for more information:

Terminal window
saber db --help
saber db add --help

After setting up your database connections:

  1. Configure authentication for AI providers
  2. Start querying your data
  3. Set up memory for better context
  4. Manage conversation threads