DbSchema is a desktop database client with a built-in AI Assistant. It answers questions about your schema, writes SQL from a plain-English description, explains queries you already have, and suggests design improvements — without leaving the application and without pasting your table structures into a web chat.
The assistant is schema-aware: it works from the tables of your design model, so it answers with your real table and column names instead of generic examples. It is also deliberately limited — the assistant reads the DDL you attach, never your data.
Click the vertical AI Assistant tab on the right edge of the DbSchema window. The panel docks beside the diagram and stays open while you work — you can keep it visible next to an ER diagram, a SQL Editor, or the Relational Data Explorer.
Type your question in the box at the bottom and send it. The panel toolbar holds four actions:
Answers come back as Markdown, with SQL inside code blocks ready to copy into an editor.
The assistant needs an AI provider before it can answer. Opening the panel for the first time offers the quickest route — free AI credits from DbSchema:
Enter your email and click Send Activation Email. DbSchema emails an activation code that unlocks a set of free credits. When the credits run out, Purchase Credits tops them up. The DbSchema AI subscription is available on every edition, including the free Community edition.
The alternative is to bring your own provider account, which requires the Architect edition — see Editions below.
Click the wrench icon in the panel toolbar to open AI Settings. The Subscription by dropdown selects who serves the model:
The Model dropdown then lists the models available for the selected provider. Pick a stronger model for design review and schema reasoning; a smaller one is usually enough for routine SQL.
The assistant is aimed at four kinds of work:
CREATE TABLE statements for a new table, an audit log, or a lookup table,
written for the database you are working with.It also answers plain database questions: how a SQL construct behaves, what a built-in function does, or which regular expression to use in the Data Generator.
The examples below use a small schema of three tables — teams, players and matches — the one
shown in the screenshot above. Because the assistant knows those tables, the questions never have to
describe them.
"Show the ten highest-scoring matches with both team names."
SELECT h.name AS home_team,
a.name AS away_team,
m.home_score + m.away_score AS total_goals,
m.match_date
FROM matches m
JOIN teams h ON h.id = m.home_team_id
JOIN teams a ON a.id = m.away_team_id
ORDER BY total_goals DESC
LIMIT 10;
"Which teams have never played a home match?"
SELECT t.name
FROM teams t
WHERE NOT EXISTS (
SELECT 1
FROM matches m
WHERE m.home_team_id = t.id
);
"Count players per position for each team."
SELECT t.name AS team,
p.position,
COUNT(*) AS players
FROM players p
JOIN teams t ON t.id = p.team_id
GROUP BY t.name, p.position
ORDER BY t.name, players DESC;
"Generate the DDL for an audit log table."
CREATE TABLE audit_log (
id BIGSERIAL PRIMARY KEY,
table_name VARCHAR(64) NOT NULL,
row_id BIGINT NOT NULL,
action VARCHAR(10) NOT NULL,
changed_by VARCHAR(100) NOT NULL,
changed_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
old_values JSONB,
new_values JSONB
);
CREATE INDEX idx_audit_log_table_row ON audit_log (table_name, row_id);
Design questions work the same way, and are often more valuable than the SQL:
A CREATE TABLE statement that comes back can be reviewed and merged into the design model, so the
assistant becomes a starting point for a diagram rather than text you retype.
Only the DDL of the tables you attach — table, column, type and relationship definitions. The assistant never connects to the database and never reads table contents. Query results, row values, passwords and connection details stay inside DbSchema.
You choose the tables yourself. The Attach (paper-clip) button opens the attachment list; + opens Attach Table DDL, where you tick a whole schema or just the tables the question is about:
Attaching less is both safer and better: a focused context produces more precise answers, and less of your schema leaves the machine.
Nothing is sent blind — DbSchema shows the exact text that travels with your question. It is plain
CREATE TABLE DDL and nothing else, and you can read every line of it before sending. The same
dialog keeps reusable question templates, and an Attach only option that hands the schema
over without asking anything:
If even the schema must not leave the machine, select Ollama as the provider and run a local model — then nothing is sent anywhere.
The assistant is steered by a system message — general instructions sent with every question. It sets the SQL dialect from the database you are connected to, and asks for Markdown answers with queries in code blocks. Edit it in Edit → Settings → General → AI Assistant to add house rules, such as a naming convention, a preferred style of SQL, or an instruction to always suggest indexes.
The same page has an Enable checkbox. Clearing it removes the assistant from the application after a restart — useful when a policy forbids AI features on a machine.
The assistant honors the proxy and TLS settings configured in Edit → Settings → Network, including SOCKS proxies and custom company certificates.
DbSchema is a desktop database client for 100+ SQL and NoSQL databases, with visual schema design, documentation, schema comparison and deployment — and a schema-aware AI Assistant built in. The Community edition is free.
See also: SQL Editor · Data Generator · Automation Scripts · Licensing