offdata ai — agentic AI for data modelers and data engineers
3 min readERDData ModelingGuide

How to Generate an ERD from a Description (AI ERD Generator Guide)

Stop dragging boxes in a diagramming tool. Generate an entity-relationship diagram — with keys, cardinality, and the DDL to back it — from a plain-English description of your domain.

An entity-relationship diagram (ERD) is the fastest way to communicate a data model: entities as boxes, attributes inside them, and lines showing how they relate. The problem is that drawing one by hand is slow, and the diagram starts drifting from the real database the moment the schema changes.

This post shows a better workflow: generate the ERD from a plain-English description using an AI ERD generator, so the diagram and the database come from the same source and never disagree.

What a good ERD actually needs

A diagram that looks nice but omits the details is worse than no diagram. A useful ERD has to capture:

  • Entities and their attributes — the tables and columns.
  • Primary keys — what uniquely identifies a row.
  • Foreign keys — how entities reference each other.
  • Cardinality — one-to-one, one-to-many, or many-to-many, drawn with crow's-foot notation.

Get any of these wrong and the diagram lies. That's why generating the ERD from a validated model matters more than the picture itself.

Step 1 — Describe the domain in plain English

Start with a sentence or two about what you're modeling. For an e-commerce store:

Customers place orders. Each order has one or more line items, and each line item points to a product. Products belong to a category.

No SQL, no diagramming — just the relationships as you'd explain them to a colleague.

Step 2 — Answer a few clarifying questions

A description always leaves gaps. OffDataAI's interview agent asks the questions that resolve them:

  • Can a product appear in many orders? (Yes — that's the many-to-many resolved by the line-item table.)
  • Is a category required on every product, or optional?
  • What uniquely identifies an order — an order ID, or customer + timestamp?

These answers pin down cardinality and keys, which is exactly what hand-drawn ERDs tend to get wrong.

Step 3 — Generate the diagram

OffDataAI renders the ERD as Mermaid, so it's text-based and version-controllable:

erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ ORDER_LINE : contains
    PRODUCT ||--o{ ORDER_LINE : "appears in"
    CATEGORY ||--o{ PRODUCT : groups

    CUSTOMER {
        string customer_id PK
        string email
        date   created_at
    }
    ORDER {
        string order_id   PK
        string customer_id FK
        date   ordered_at
    }
    ORDER_LINE {
        string order_id   FK
        string product_id FK
        int    quantity
    }
    PRODUCT {
        string product_id PK
        string category_id FK
        string name
    }

Because it's Mermaid, you can drop it straight into a README, a docs site, or a pull request — no binary diagram file to keep in sync.

Step 4 — Get the DDL

The ERD is just a view of the underlying model. From the same description, OffDataAI also emits runnable DDL for your target warehouse — Snowflake, BigQuery, Databricks, Redshift, or Postgres — plus a complete dbt project and seed data. Edit the model and the diagram and the DDL regenerate together, so the picture always matches what you deploy.

Why generate instead of draw

Hand-drawn ERDGenerated ERD
Drifts from the real schemaAlways matches the model and DDL
Cardinality is guessworkDerived from confirmed relationships
Separate file to maintainA view of one source of truth
No code attachedShips with DDL, dbt, and seeds

Try it

Describe your domain and watch the ERD appear — then take the DDL and dbt project that come with it. Start with the AI ERD generator, or read more about AI data modeling end to end.


Try OffDataAI

Ship a warehouse from a single conversation.

Describe your domain. Get ERDs, DDL, dbt projects, and seed data for every major cloud warehouse.

Start building — free