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.

SQLsaber skips noisy system schemas for every supported database when it introspects metadata, and you can layer on your own exclusions during setup or later via saber db exclude.

Default exclusions:

  • PostgreSQL: pg_catalog, information_schema, _timescaledb_internal, _timescaledb_cache, _timescaledb_config, _timescaledb_catalog
  • MySQL: information_schema, performance_schema, mysql, sys
  • DuckDB / CSV: information_schema, pg_catalog, duckdb_catalog

When you run saber db add, the interactive flow prompts for extra schemas to ignore (or pass --exclude-schemas schema1,schema2 in non-interactive mode). You can revisit an existing connection at any time:

Terminal window
# Replace the exclusion list interactively
saber db exclude my-database
# Append specific schemas
saber db exclude my-database --add reporting_temp,rollups

For ad-hoc connections created from raw URLs or file paths, use environment variables to extend the default filters:

Terminal window
export SQLSABER_PG_EXCLUDE_SCHEMAS="schema1,schema2"
export SQLSABER_MYSQL_EXCLUDE_SCHEMAS="temp_db, staging"
export SQLSABER_DUCKDB_EXCLUDE_SCHEMAS="internal_schema"

Both the list_tables and introspect_schema tools respect these filters.

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