Import DBML

If your schema lives in DBML — a dbdiagram.io export, a dbdocs project, or a .dbml file in your repo — paste it into DrawSQL and get the full visual diagram: tables, relationships, enums, groups, even sticky notes.

 Table users {
  id int [pk, increment]
  email varchar [unique, not null]
  created_at timestamp
}

Table posts {
  id int [pk, increment]
  user_id int [not null]
  title varchar
  status post_status
}

Enum post_status {
  draft
  published
}

Ref: posts.user_id > users.id

Importing DBML

  1. In the diagram editor, click FileImport — or open the /draw playground to try it without an account.

  2. Paste your DBML or upload the .dbml file. The format is auto-detected.

  3. Click Begin Import. Syntax errors are reported with line numbers, so a broken file tells you exactly where to look.

DBML doesn't carry a SQL dialect, so DrawSQL resolves the column types for a target DBMS. In the editor that's your diagram's DBMS; on /draw you pick it with the into MySQL / PostgreSQL / SQL Server control.

Coming from dbdiagram.io? Use Export → DBML there, then paste the result straight in.

What gets imported

  • Tables and columns, with types, defaults, and nullability

  • Ref: definitions — drawn as relationships

  • Enums, including columns typed against them

  • Indexes, including unique and multi-column ones

  • TableGroup blocks — imported as table groups on the canvas

  • Table and column notes — imported as comments

  • Standalone Note name { … } blocks — imported as sticky notes

Known limits

A few DBML constructs don't map onto DrawSQL diagrams. Each one is skipped and flagged in the import log, so you always know what was left out:

  • Many-to-many refs (<>) — model the join table explicitly instead

  • Composite foreign keys — DrawSQL relationships connect one column pair

  • Expression columns inside index definitions

  • Header colors — DrawSQL assigns its own palette on import

Still have a question? We'd love to help!