SQL to PlantUML
Paste a PostgreSQL or MySQL dump and copy PlantUML — entities with their keys, nullability and crow’s foot relations, ready for a .puml file. No Java, no Graphviz, no Docker and no database connection: the schema is parsed in your browser and never uploaded.
Paste your own dump, then use Export → PlantUML — it copies to the clipboard.
What comes out
This is the real export of the schema above, trimmed to two entities so it fits on the page — same header, same markers, same relation lines:
@startuml
' Generated with erddocs.com — paste SQL, get an ER diagram and a data dictionary
hide circle
skinparam linetype ortho
entity "projects" as projects {
*id : BIGSERIAL <<PK>>
--
*key : VARCHAR(10) <<UK>>
*name : VARCHAR(120)
*lead_id : BIGINT <<FK>>
}
entity "issues" as issues {
*id : BIGSERIAL <<PK>>
--
*project_id : BIGINT <<FK>>
*number : INT
*title : VARCHAR(240)
*state : VARCHAR(16)
*reporter_id : BIGINT <<FK>>
assignee_id : BIGINT <<FK>>
parent_id : BIGINT <<FK>>
*opened_at : TIMESTAMPTZ
closed_at : TIMESTAMPTZ
}
projects }o--|| users : lead_id
issues }o--|| projects : project_id
issues }o--|| users : reporter_id
issues }o--|| users : assignee_id
issues }o--|| issues : parent_id
@enduml- Keys are marked, not guessed at by the reader —
<<PK>>,<<FK>>and<<UK>>, with the primary key columns first and a rule under them. - Nullability is in the syntax — PlantUML’s leading
*means mandatory, soassignee_idbeing optional is visible without a legend. - Types keep their size and precision —
VARCHAR(240)stays 240 characters andNUMERIC(10,2)stays two decimal places. Nothing is flattened into a generic “string” or “number”. A self-reference likeparent_idis drawn as a real line from a table to itself. - The header makes it an ER diagram —
hide circledrops the class-diagram bubble, andskinparam linetype orthogives right-angled edges.
Why this is usually a five-tool job
Search for a SQL-to-PlantUML converter and you find command-line projects: one needs a JVM, another a Graphviz binary on the PATH, a third a running database to reverse-engineer, and the friendliest of them still expects a container. That is a reasonable trade for a pipeline you run every week, and a poor one for the far more common case: you have a dump in front of you and you want the diagram now, on a machine where you would rather not install a JDK. ErdDocs is the whole toolchain for that case — one tab, nothing installed.
The other half of that trade is trust. A dump is your schema: table names, column names, the shape of the business. ErdDocs parses it inside the tab, so it never crosses a network — which a hosted converter cannot promise however good its intentions.
Getting the dump
- 01
pg_dump --schema-only mydb > schema.sqlfor PostgreSQL, ormysqldump --no-data mydb > schema.sqlfor MySQL. Neither reads a single row of data. - 02Paste the file above, or drop it onto the panel.
- 03Export → PlantUML, paste into your
.pumlfile. Mermaid and DBML sit in the same menu if the target is a README or dbdiagram instead.
FAQ
Do I need Java, Graphviz or Docker?
No. ErdDocs parses the schema with JavaScript in the browser tab you already have open, and the PlantUML is text you copy. Every other route from SQL to PlantUML is a command-line tool that renders locally: ddl2plantuml, planter and SchemaCrawler all want a JVM, a Graphviz binary, a container, or a live database connection. You only need a PlantUML renderer afterwards if you want a picture — and you already have one, since ErdDocs draws the diagram itself.
What does the generated PlantUML contain?
One entity per table, primary key columns first and separated by a rule, then the rest. Keys are marked <<PK>>, <<FK>> and <<UK>>, mandatory columns carry PlantUML’s asterisk, and types keep the size and precision they were declared with. Relations are crow’s foot lines labeled with the foreign key column, and enums become enum blocks. The header sets hide circle and ortho line routing, so it looks like an ER diagram rather than a class diagram.
My dump has no foreign keys — Rails and Django often skip them.
ErdDocs then recovers the relations from column naming, so an author_id column links to the authors table. In the PlantUML output those lines are labeled "(by name)", so a reader can always tell a key the database declares from one that ErdDocs inferred. Nothing is silently invented.
Does it work with MySQL as well as PostgreSQL?
Yes. Paste pg_dump --schema-only output, mysqldump --no-data output, or plain CREATE TABLE statements; the dialect is detected from the text. MySQL AUTO_INCREMENT and inline COMMENT clauses, and PostgreSQL sequences, ALTER TABLE ONLY ... ADD CONSTRAINT idioms and COMMENT ON statements, are all understood.
Is it free?
Copying PlantUML is free at any schema size, with no account — the 25-table limit is on how many tables get drawn, not on what gets converted. The exported text carries one comment line naming ErdDocs; a $9 license removes it and lifts the size limit, and also unlocks the data dictionary.
Related
- Mermaid ER diagram generator — when the diagram belongs in a README instead.
- PostgreSQL data dictionary generator — the same pg_dump file read as a document, COMMENT ON and all.
- DBML to ER diagram — dbdiagram’s language, read and written.
- Prisma schema to ER diagram — the database a schema.prisma generates.
- Data dictionary generator — the same dump as a printable document.
- Example schemas — eleven domains with SQL to paste.
- SQL to ER diagram — the tool itself, with every format it reads.