Skip to content

Import & Export

ERDHub lets you bring existing SQL schemas in and export your diagrams in multiple formats.

Import SQL

WARNING

SQL Import is available on Pro and Team plans.

Import existing CREATE TABLE statements directly into ERDHub. The importer parses your SQL and converts it to the ERDHub DSL and visual diagram.

Supported Dialects

  • PostgreSQL
  • MySQL / MariaDB

Input Methods

You can provide SQL in three ways:

  1. Paste — Copy your SQL and paste it into the import text area
  2. Upload file — Click to upload a .sql or .txt file
  3. Drag and drop — Drag a file directly onto the import dialog

What Gets Imported

The importer recognizes the following SQL constructs:

ConstructExampleNotes
Tables and columnsCREATE TABLE users (id INT, ...)Column names, types, and constraints
Primary keysPRIMARY KEY (id)Inline or table-level
Foreign keysREFERENCES users(id)Inline or ALTER TABLE ... ADD FOREIGN KEY
Not null / uniqueNOT NULL, UNIQUEColumn-level constraints
Default valuesDEFAULT now()Literal values and expressions
PostgreSQL enumsCREATE TYPE status AS ENUM (...)Converted to ERDHub Enum blocks
MySQL inline enumsstatus ENUM('a','b','c')Promoted to named enum types as {table}_{column}
Table commentsCOMMENT ON TABLE ...PostgreSQL comment syntax

Import Results

On success, ERDHub displays a summary:

  • Number of tables imported
  • Number of relationships detected

The imported schema appears in your DSL editor and renders on the canvas immediately.

Error Handling

If the SQL contains syntax errors or unsupported constructs, the importer shows detailed error messages indicating:

  • The line number where the error occurred
  • A description of what was expected vs. what was found

TIP

For best results, import a clean DDL dump. Remove any INSERT statements, stored procedures, or vendor-specific extensions before importing.

Export

ERDHub supports three export formats, all accessible from the Export dropdown in the canvas toolbar.

PNG

Export your diagram as a high-resolution PNG image.

PropertyValue
Resolution2x (high-DPI / Retina)
BackgroundWhite
Bounding boxAutomatic — fits all visible elements
Filenameerdhub_YYYYMMDD_HHMM.png

Best for embedding in documentation, presentations, or sharing in chat.

SVG

Export as a scalable vector graphic.

PropertyValue
ScalabilityInfinite — no quality loss at any zoom level
BackgroundWhite
Filenameerdhub_YYYYMMDD_HHMM.svg

Best for print materials, technical documentation, or when you need to edit the diagram in a vector graphics tool.

SQL

Export the generated DDL script for your target database.

PropertyValue
DialectsPostgreSQL, MySQL
Output optionsCopy to clipboard or download as .sql file
PreviewSyntax-highlighted SQL with statistics

The SQL export preview displays:

  • Table count — number of tables in the schema
  • Relationship count — number of foreign key relationships
  • Line count — total lines in the generated DDL

TIP

Use the dialect selector to switch between PostgreSQL and MySQL output. The generated SQL uses dialect-appropriate syntax — for example, PostgreSQL uses SERIAL and CREATE TYPE ... AS ENUM, while MySQL uses AUTO_INCREMENT and inline ENUM(...).

Workflow Examples

Migrating an existing database to ERDHub

  1. Export your database schema as a SQL dump (DDL only)
  2. Open ERDHub and click Import SQL
  3. Paste your SQL or drag the .sql file into the dialog
  4. Review the imported schema on the canvas
  5. Adjust layout using auto-layout or manual positioning
  6. Save the project

Exporting for a code review

  1. Finalize your schema in the editor
  2. Click Export and choose PNG for a visual overview
  3. Click Export again and choose SQL with your target dialect
  4. Attach the PNG to your pull request and include the SQL in your migration file

Next Steps