ErdDocs

DBML to ER diagram

Paste a DBML file — dbdiagram’s schema language — and get an interactive ER diagram straight away, plus the printable data dictionary that every other DBML viewer leaves out. No account, nothing installed; the file is parsed in your browser and never uploaded.

Your schema

The example carries notes, so its dictionary has a Description column. Replace it with your own file.

A viewer is half of what you needed

ErdDocs gives you both halves from one paste. There is no shortage of places to look at a DBML file; what is still missing is the artifact people actually get asked for — the document. A diagram answers “how do these tables connect”; it does not answer “what is in orders.status, can it be null, what is the default". One click from the diagram above is a data dictionary listing every table, column, type, nullability, default, index and both directions of every relation, with your notes as descriptions — the thing you print and hand to an auditor, a client, or the person who joins on Monday.

The diagram is not a static image either: drag tables where you want them, hide the ones that are noise, click a relation to read its cardinality, and put the arrangement in the URL so the next person opens the picture you meant.

What the parser takes from DBML

  • Columns and their settings — [pk], [not null], [unique], [default: …], [increment], and the type exactly as you wrote it, size and all.
  • Composite keys and indexes — an Indexes block with (a, b) [pk] makes a real composite primary key, which is how the line items table above is keyed.
  • Both ways of writing a reference — inline ref: > customers.id on the column, or a standalone Ref: line at the bottom of the file. Either becomes a solid relation, because DBML declares it rather than implying it.
  • Notes and enums — notes become descriptions, enum blocks become types the dictionary lists with their values.

And the way back

Most DBML files are not written by hand — they are produced from a database someone already has. That direction works here too: paste a pg_dump --schema-only file, a schema.prisma, or a Mermaid diagram, and export DBML. The round trip is a test, not a hope: what the exporter writes, the parser reads back into the same schema, which is how a stray space in a type got caught before it shipped.

FAQ

Which parts of DBML are read?

Table blocks with column types and settings (pk, not null, unique, default, note), composite primary keys and indexes declared in an Indexes block, enum definitions, both inline refs written as ref: > and standalone Ref lines, and Note text on tables and columns. A Project block is read for its database_type and otherwise ignored, because it describes the file rather than the schema.

Is this dbdiagram.io?

No relation. ErdDocs reads DBML — dbdiagram’s schema language, and a good one, clean enough that people write it by hand — without an account, keeps the file on your machine, and adds the document half: the same paste that draws the diagram also produces a data dictionary you can print.

Can I go the other way and get DBML out?

Yes. Paste a PostgreSQL or MySQL dump, a Prisma schema, or Mermaid, and export DBML — which is how most DBML files that are not written by hand get made. The round trip is tested: what the exporter writes, the parser reads back into the same schema.

What do notes turn into?

Descriptions. A Note on a table or a column becomes the Description column of the data dictionary, so a DBML file that documents itself produces a document that needs no further editing. A file without notes simply gets no Description column — the dictionary never shows empty scaffolding.

Is it free?

Drawing the diagram and exporting the picture are free, with no account, for schemas up to 25 tables. Larger files are parsed completely and the extra tables are shown as locked placeholders. One payment of $9 unlocks any size, the complete dictionary and exports without our mark.

Related