Back to all posts

AI ER Diagram Generators Compared

For developers who want an AI tool to draw an ER diagram, either of a new design or of a database that already exists.

On this page

You type "an online shop with customers and orders", and an AI ER diagram generator draws tables, keys and lines. The diagram shows what the AI model predicted from your words. If the database already exists, choose DbSchema. DbSchema connects to the database and reverse-engineers its real tables, keys and constraints into a diagram. Its AI Assistant then writes CREATE TABLE statements that you can merge into the same model.

Eraser, ChartDB, dbdiagram.io, Lucidchart, Miro and Visual Paradigm also turn a prompt into a first diagram of a new design. Every vendor fact below was checked on the vendor's own site on 12 November 2026.

Try DbSchema on your own database

Free Community Edition plus a 15-day Architect trial. No signup. Windows, macOS and Linux.

Where the diagram comes from

An AI ER diagram generator gets its tables from one of two places: your words, or your database.

A prompt goes to an AI model, which draws a predicted diagram; DbSchema connects to your database and reverse-engineers its catalog into a diagram of the real schema

A prompt-based generator sends your description to an AI model. You can also paste code, such as a SQL schema or an ORM schema. The model then guesses the entities, columns, keys and cardinalities. The diagram can match your prompt exactly and still differ from the database, because the generator never reads the database. Why a chat model can't draw your schema shows the mistakes this leads to.

A reverse-engineered diagram starts from the catalog, where the database describes its own tables. Take two tables in PostgreSQL 18:

CREATE TABLE customers (
  id integer PRIMARY KEY,
  email text NOT NULL UNIQUE
);

CREATE TABLE orders (
  id integer PRIMARY KEY,
  customer_id integer NOT NULL REFERENCES customers (id),
  status text NOT NULL CHECK (status IN ('open', 'paid', 'shipped'))
);

This query reads their constraints from the catalog, leaving out the NOT NULL ones:

SELECT conrelid::regclass AS table_name,
       conname AS constraint_name,
       pg_get_constraintdef(oid) AS definition
FROM pg_constraint
WHERE connamespace = 'public'::regnamespace
  AND contype <> 'n'
ORDER BY 1, 2;
table_nameconstraint_namedefinition
customerscustomers_email_keyUNIQUE (email)
customerscustomers_pkeyPRIMARY KEY (id)
ordersorders_customer_id_fkeyFOREIGN KEY (customer_id) REFERENCES customers(id)
ordersorders_pkeyPRIMARY KEY (id)
ordersorders_status_checkCHECK ((status = ANY (ARRAY['open'::text, 'paid'::text, 'shipped'::text])))

The catalog lists every constraint, including the names that PostgreSQL chose, such as orders_status_check. PostgreSQL stores the CHECK in its own form, not as it was typed. A diagram reverse-engineered from the catalog draws the keys that the database declares. A prompt holds only the keys that you typed into it.

ChartDB and Lucidchart sit between a prompt and a connection. Each gives you a query to run on your database, and you paste its output. The diagram then shows your schema as it was when you ran the query.

The generators compared

DbSchema comes first: it reads the schema through a connection to the database. The tools that import the output of a query come next, then the tools that start from a prompt.

ToolThe diagram starts fromAI without a paid planWhat you get
DbSchemaA connection to your database, or a question to the AI AssistantAI trial of two weeks and up to 100 questions, in every editionThe real schema as a diagram; CREATE TABLE statements to merge
ChartDBA prompt, or the output of a query you run on your databaseAI Assistant listed on the Team plan onlyAn editable diagram, and DDL export
LucidchartA prompt to Lucid AI, or the output of a query you run on your databaseLucid AI included on the Free planA diagram, and SQL export without the connections between tables
EraserA prompt, or pasted code such as a SQL or ORM schema3 AI credits and 3 files on the Free planDiagram code and its diagram, editable after you sign in
dbdiagram.ioA prompt to the AI AssistantNone: the AI Assistant is on the Personal Pro planDBML code and its diagram
MiroA prompt, or sticky notes and text on a board10 AI credits a monthEditable shapes on a Miro board
Visual ParadigmA description, DBML or SQL CREATE statementsFull access with VP Online Deluxe or VP Desktop ProfessionalA diagram in OpenDocs, VP Online or VP Desktop

If you need a diagram of a database that already exists, only the first three rows read the schema from the database, and only DbSchema connects to it. If you are sketching a new design, every row turns a prompt into a first diagram.

DbSchema draws the diagram from your database

DbSchema is a desktop application for Windows, macOS and Linux. DbSchema connects to the database through a JDBC driver, and downloads the driver the first time you connect. The steps are in connect to a database:

  1. Choose File → New Model.
  2. Keep Connect to Database selected, and click your database, such as PostgreSQL.
  3. Choose New Connection, fill in the connection dialog, and press Connect.
  4. In Reverse Engineer the Database, tick the schemas to import and press Load.
The DbSchema Reverse Engineer the Database dialog listing the schemas of shopdb, with shopdb.shop ticked

DbSchema draws the imported tables in a new model. The model is DbSchema's own copy of the schema, which you can save as a file. Each foreign key is a line between two tables. Connecting and importing only read from the database and change nothing in it.

DbSchema diagram of the reverse-engineered customers and orders tables, with the foreign key line from orders.customer_id to customers.id

MongoDB declares no foreign keys, and MySQL's MyISAM engine ignores foreign keys. For links like these, add a virtual foreign key. DbSchema draws the virtual foreign key on the diagram and never creates it in the database. To keep it, you save the model file, and saving needs DbSchema Pro.

The AI Assistant is a side bar beside the diagram. Select tables on the diagram, right-click one of them and choose Attach to AI. The Ask AI dialog shows what will be sent: the CREATE TABLE statements of those tables, which you can edit.

The DbSchema Ask AI dialog with the question templates Optimize query and Improve performance, and the CREATE TABLE statement of customers as the attachment

Ask for a new table, and the answer comes back with SQL in code blocks. Preview shows a CREATE TABLE on a preview diagram. Merge adds the CREATE or ALTER statement to the model. DbSchema sends your question, the conversation and the structure of the attached tables. It never sends table rows, query results, passwords or connection details.

The AI Assistant answers through DbSchema's own AI subscription. The AI trial lasts two weeks, for up to 100 questions, and works in every edition, the free Community Edition included. After the trial, you buy credits. To use your own account at an AI company, such as OpenAI or Anthropic, you need DbSchema Pro or Architect. In AI Settings, you can also choose Ollama, which runs a model on your own computer. Then nothing leaves your computer.

What an AI assistant sees of your database covers the AI Assistant's privacy in more detail.

ChartDB and Lucidchart import the schema from one query

ChartDB runs in the browser, on ChartDB's cloud or on your own server. To import a database, you run one query that ChartDB gives you, copy the JSON result, and paste it into ChartDB. No database password is needed (ChartDB on GitHub). ChartDB's AI ER diagram generator also draws a diagram from a prompt. ChartDB's code is open source under AGPL-3.0. If you host ChartDB yourself, its AI needs your own OpenAI API key, or another endpoint and model.

On ChartDB's cloud, the pricing page lists a free plan of one database with up to 10 tables. It lists the AI Assistant and Auto-Sync on the Team plan.

Lucidchart imports a schema in the same way. In the ERD import, you choose your database system and copy Lucid's query. You run the query on your database, then paste or upload its output. Lucidchart can export the diagram as SQL, except for the connections between tables (Lucid's ERD help). Lucid AI can also generate an ERD from a prompt. Lucid's help lists Lucid AI on the Free, Individual, Team and Enterprise plans, and says it may become a paid subscription.

The Lucidchart editor with an ER diagram, a Generate with AI button and an ERD Import panel

An imported diagram stays as it was when you ran the query. After a migration, you run the query again and import the new output, or use ChartDB's Auto-Sync on the Team plan.

Eraser and dbdiagram.io write the diagram as code

Eraser's ERD generator takes plain English, a nested list or pasted code. You can paste part of an existing SQL or ORM schema. Generating needs no sign-up. To edit, save or export the diagram, you sign in to a free Eraser account. The diagram is code that you can edit as text or on the canvas. The free plan includes 3 AI credits and 3 files (Eraser pricing).

dbdiagram.io's AI Assistant writes DBML, dbdiagram.io's text format for tables and references, from a chat. It shows a preview of the changes in a diff viewer. The AI Assistant is on the Personal Pro plan.

A chat model such as ChatGPT can be asked for the same kind of text. Mermaid's erDiagram syntax is one target: it marks keys as PK, FK or UK (unique key) and draws crow's foot lines. The model still writes from your words, as every prompt-based generator does.

Miro and Visual Paradigm draw on a board or in a document

Miro's ER diagram AI works on a Miro board. You type a prompt, or select sticky notes and text blocks on the board, and Miro AI proposes an entity-relationship structure as editable shapes. Miro's pricing page gives the free plan 10 AI credits a month.

Visual Paradigm's AI DBML and SQL schema diagram generator is part of its AI chatbot. It takes DBML, SQL CREATE statements or a plain-English description. The diagram can go to OpenDocs, Visual Paradigm's document editor, or to VP Online and VP Desktop. Full access to the generator comes with a VP Online Deluxe or VP Desktop Professional subscription, and a free trial is available.

Draw your own database with DbSchema

Download DbSchema, connect it to your database, and reverse-engineer the schemas into a diagram. Then attach the tables you are changing to the AI Assistant, and ask it for the next CREATE TABLE. The diagram, the SQL editor and the AI trial are in the free Community Edition. Saving the model file and your own AI provider key need DbSchema Pro.

Frequently asked questions

Can AI generate an ER diagram from an existing database?

The prompt-based generators draw from the text you give them. ChartDB and Lucidchart import the output of a query you run on the database. DbSchema connects to the database and reverse-engineers it, then lets its AI Assistant work on the tables you attach.

Is there a free AI ER diagram generator?

Eraser generates a diagram without sign-up, and Miro and Lucidchart include AI on their free plans. DbSchema's free Community Edition reverse-engineers the database into a diagram, and its AI trial covers up to 100 questions.

Sources

  1. DbSchema: connect to a database, foreign keys and AI Assistant
  2. ChartDB on GitHub, AI ER diagram generator and pricing
  3. Lucidchart ERD help and Lucid AI
  4. Eraser ERD generator and pricing
  5. dbdiagram.io AI Assistant
  6. Mermaid erDiagram syntax
  7. Miro ER diagram AI and pricing
  8. Visual Paradigm AI DBML and SQL schema diagram generator

Draw the ER diagram from your real database

DbSchema Community Edition connects to your database, reverse-engineers it into an interactive ER diagram and runs the SQL editor, free.