SQL Console

SQL Console is the main workspace for writing and running SQL in Dory. It works together with Explorer, AI Chat, result tables, charts, and Saved Queries.

Interface Structure

SQL Console typically includes:

  • A connection and schema context.
  • A SQL editor.
  • Query execution controls.
  • Result tables and chart entry points.
  • Access to AI assistance.
  • Saved query actions.

Dory SQL Console interface

Writing SQL

Start with small, safe queries. Confirm table and column names in Explorer before adding complex filters, joins, or aggregations.

Dory SQL Console editor and autocomplete

Running Queries

Run SQL against the selected connection. Review results, errors, and execution behavior before using the output for decisions.

Dory SQL Console query result

Multi-Tab Workflow

Use multiple tabs to keep exploration, final analysis, and alternative query drafts separate.

Dory SQL Console tabs and top controls

Use the Left Schema Panel

The schema panel helps you avoid guessing names:

select *
from your_table
limit 20;

Open tables in Explorer when you need more detail.

Dory SQL Console schema panel

AI Copilot

Use AI to generate SQL, explain SQL, fix errors, optimize queries, or reshape output for charts. Copilot is organized into Ask, Action, and Context tabs. Always review generated SQL before running it.

Ask

Use Ask for open-ended SQL help. You can ask Copilot to generate a query, explain current SQL, reason about an error, or suggest the next analysis step from the current editor and result context.

Dory SQL Console Ask AI panel

Action

Open the Action tab in Copilot to run focused SQL actions against the current editor SQL and latest execution context.

Dory SQL Console Copilot actions

Use the built-in actions for common SQL iteration loops:

  • Fix SQL errors: uses the latest execution error to propose a corrected SQL version.
  • Optimize performance: rewrites SQL to reduce unnecessary scans, simplify filters, or improve execution shape.
  • Rewrite SQL: restructures SQL for readability while preserving the intent.
  • Convert to aggregation: turns row-level SQL into grouped, metric-oriented SQL for summaries and charts.

After you run an action, Copilot opens a result panel with a short explanation, SQL preview or diff, and Copy / Apply controls.

Fix SQL errors

Dory Copilot Fix SQL errors result

Optimize performance

Dory Copilot Optimize performance result

Rewrite SQL

Dory Copilot Rewrite SQL result

Convert to aggregation

Dory Copilot Convert to aggregation result

Context

Open the Context tab to inspect what Copilot will use before it answers: editor SQL, selected SQL, database, referenced tables, confidence, execution status, row count, and result profile. Use it to confirm Copilot is working from the right query and result set.

Dory SQL Console Copilot context

Results and Charts

After execution, inspect the result table. If the result is aggregated and well-shaped, create a chart from it.

Dory SQL Console charts view

Desktop SQLite Example

After creating a SQLite connection from /Users/Shared/Data/demo.sqlite, open SQL Console with that connection selected. The left schema panel should show the SQLite main database and its tables.

Run a chart-friendly aggregate query:

select strftime('%Y-%m', created_at) as month,
       status,
       round(sum(amount), 2) as revenue,
       count(*) as orders
from orders
group by month, status
order by month, status;

The result table confirms that Dory executed the SQL against the local SQLite file.

Dory desktop SQL Console SQLite result

Switch from Table to Charts to inspect the same result visually. Dory can use the month column as the X axis and a numeric metric such as revenue or count as the Y axis.

Dory desktop SQL Console SQLite chart

Save Queries

Save useful SQL with a clear name and description after it has been validated.

Dory SQL Console save query dialog

Best Practices

  • Use read-only credentials for production data.
  • Start with limit and narrow filters.
  • Keep one query goal per tab.
  • Validate AI output against schema and sample rows.
  • Save only queries that are useful beyond the current session.

Continue with AI Chat, Charts & Results, or Saved Queries.

How is this guide?