---
title: Getting Started
description: Your first steps with SQLsaber
---

import { Aside } from "@astrojs/starlight/components";

Welcome to SQLsaber! This guide will walk you through setting up SQLsaber and running your first query.

Before you begin, make sure you have:

1. [Installed SQLsaber](/installation)
2. Access to a database (PostgreSQL, MySQL, SQLite, or DuckDB)
3. An API key from a supported AI provider (Anthropic, OpenAI, Google, etc.)

### Quick Setup

#### 1. Launch the Onboarding Flow

Run SQLsaber with no arguments to start the guided setup:

```bash
saber
```

On your first run, SQLsaber walks you through two guided steps:

1. **Database connection**:
   Choose the database type and provide connection details.

2. **Authentication**:
   Sign in to your preferred AI provider and pick a model. We recommend Sonnet 4.5, 4 or GPT-5.

   `sqlsaber` will store your API key securely using your OS credential store.

When both steps succeed you'll see a confirmation screen, and SQLsaber immediately opens an interactive session.

<Aside type="tip">
  If you have a Claude Pro or Max subscription, you can use it with SQLsaber for
  a cost-effective setup.
</Aside>

<Aside type="tip">
    If you already have a connection string handy, pass it via `saber -d <connection-string>` to skip the onboarding flow.
</Aside>

<Aside type="note">
  Need a sample database?

Download the `legislators` SQLite file, then choose `sqlite` when the onboarding flow prompts for a database location (or add it with `saber db add`):

```bash
curl -L -o legislators.db https://github.com/SarthakJariwala/sqlsaber/raw/refs/heads/main/legislators.db
```

</Aside>

#### 2. Ask Your First Question

Once onboarding completes, you're already in interactive mode. Try asking a
question:

```
> How many VPs have become presidents via election in 20th century?
```

SQLsaber will:

1. Analyze your database schema
2. Generate appropriate SQL
3. Execute the query
4. Present the results and analysis

<script
  src="https://asciinema.org/a/39e71PIiGJetHBPy08L1TOotB.js"
  id="asciicast-39e71PIiGJetHBPy08L1TOotB"
  async="true"
></script>

### Interactive Mode

In interactive mode, you have access to several helpful features:

- Slash Commands
  - `/clear` - Clear the conversation history
  - `/exit` or `/quit` - Exit SQLsaber

- Table Name Autocomplete
  - Type `@` followed by a table name to get autocomplete suggestions:

### Non-Interactive Mode

You can also run single queries without entering interactive mode:

```bash
# Direct query
saber "How many users are there?"

# Using a specific database
saber -d my-database "Show me the latest orders"

# Reading from stdin
echo "Count all products by category" | saber

# Send output to a file
saber "Show me the latest orders" > latest_orders.md
```

### Next Steps

Now that you have SQLsaber running, explore these features:

- **[Set up memory](/guides/memory)** - Add context about your database for better results
- **[Manage conversation threads](/guides/threads)** - Resume your conversations
- **[Configure different models](/guides/models)** - Try different AI models
- **[Advanced database setup](/guides/database-setup)** - Configure SSL, connection strings, and more

### Getting Help

- Use `saber --help` to see all available commands
- Check the [command reference](/reference/commands) for detailed documentation
- Visit our [GitHub repository](https://github.com/SarthakJariwala/sqlsaber) for issues and contributions

### Troubleshooting

#### Common Issues

**"No database connections configured"**

```bash
saber db list  # Check configured databases
saber db add my-db  # Add a new database
```

**"Authentication not configured"**

```bash
saber auth status  # Check auth status
saber auth setup   # Set up authentication
```

**"Database connection failed"**

```bash
saber db test my-database  # Test the connection
```

For more troubleshooting help, see our [installation guide](/installation).
