Appearance
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:
- Paste — Copy your SQL and paste it into the import text area
- Upload file — Click to upload a
.sqlor.txtfile - Drag and drop — Drag a file directly onto the import dialog
What Gets Imported
The importer recognizes the following SQL constructs:
| Construct | Example | Notes |
|---|---|---|
| Tables and columns | CREATE TABLE users (id INT, ...) | Column names, types, and constraints |
| Primary keys | PRIMARY KEY (id) | Inline or table-level |
| Foreign keys | REFERENCES users(id) | Inline or ALTER TABLE ... ADD FOREIGN KEY |
| Not null / unique | NOT NULL, UNIQUE | Column-level constraints |
| Default values | DEFAULT now() | Literal values and expressions |
| PostgreSQL enums | CREATE TYPE status AS ENUM (...) | Converted to ERDHub Enum blocks |
| MySQL inline enums | status ENUM('a','b','c') | Promoted to named enum types as {table}_{column} |
| Table comments | COMMENT 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.
| Property | Value |
|---|---|
| Resolution | 2x (high-DPI / Retina) |
| Background | White |
| Bounding box | Automatic — fits all visible elements |
| Filename | erdhub_YYYYMMDD_HHMM.png |
Best for embedding in documentation, presentations, or sharing in chat.
SVG
Export as a scalable vector graphic.
| Property | Value |
|---|---|
| Scalability | Infinite — no quality loss at any zoom level |
| Background | White |
| Filename | erdhub_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.
| Property | Value |
|---|---|
| Dialects | PostgreSQL, MySQL |
| Output options | Copy to clipboard or download as .sql file |
| Preview | Syntax-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
- Export your database schema as a SQL dump (DDL only)
- Open ERDHub and click Import SQL
- Paste your SQL or drag the
.sqlfile into the dialog - Review the imported schema on the canvas
- Adjust layout using auto-layout or manual positioning
- Save the project
Exporting for a code review
- Finalize your schema in the editor
- Click Export and choose PNG for a visual overview
- Click Export again and choose SQL with your target dialect
- Attach the PNG to your pull request and include the SQL in your migration file
Next Steps
- Editor Overview — learn about the full editor interface
- Version History — track changes to your schema over time
- SQL Dialects — dialect-specific details