Run your first query

Use natural-language prompts to write SQL, then run, refine, and save it.

Last updated

Cocobox blends a normal SQL editor with an AI assistant. You can write SQL by hand, generate it from a prompt, or hand the assistant a question and let it iterate. This guide takes the prompt-first path.

1. Open a snippet

A snippet is a saved unit of SQL with a name, an editor, and a result panel. Click New snippet in the sidebar (or press N).

Pick a connection from the connection picker at the top of the editor.

2. Ask a question

Press ⌘ I (macOS) or Ctrl I (Windows / Linux) to open the inline AI prompt. Type a question in plain English, for example:

Top 10 products by revenue in the last 30 days, with the customer who bought the most of each.

Cocobox sends the prompt — plus the connected database’s schema and any tables you’ve explicitly pinned — to the model you’ve selected. It returns SQL inline. Press Tab to accept, or Esc to discard.

3. Run it

Press ⌘ Enter / Ctrl Enter or click Run. Results stream into the table at the bottom. If the query errors, Cocobox shows the DB’s exact error message and offers an Ask AI to fix it button.

4. Refine

The AI prompt remembers context within the snippet. Follow up with:

Add the customer’s email and segment from the customers table.

The model amends the existing query rather than rewriting from scratch. You can keep refining until it’s right.

5. Save & share

Snippets autosave. To share with a teammate, click Share → pick a teammate → choose a role (view, run, edit). They get a notification and the snippet appears in their Shared with me folder.

For programmatic access, use the API → Chat completions or API → Messages endpoints — they accept the same prompts and return SQL the same way.

Next steps