Skip to main content

SQL Import Feature - User Guide

Overview

The SQL Import feature allows you to upload SQL dump files (MySQL, PostgreSQL, SQLite) and automatically import all database tables into your flow diagram with full relationship visualization.

Key Features

AST-Based Parsing: Uses Abstract Syntax Tree for robust, bidirectional SQL conversion
🔄 Bidirectional Editing: Edit tables in UI, automatically sync with SQL
🗄️ Multi-Dialect: Supports MySQL, PostgreSQL, and SQLite with auto-detection
📝 Visual Editing: Edit table structures using the properties panel
🔗 Auto-Relationships: Foreign keys are automatically drawn as connecting arrows
💾 Regenerate SQL: Convert modified tables back to SQL at any time

How to Use

1. Upload SQL File

  1. Open your flow diagram
  2. Click the SQL Import button (database import icon) in the left sidebar
  3. Click "Upload SQL File"
  4. Select a .sql file from your computer

The system will:

  • Automatically detect the SQL dialect (MySQL/PostgreSQL/SQLite)
  • Parse all CREATE TABLE statements
  • Display a summary with table count and relationships

2. Review Imported Schema

  • Click on a source to expand it
  • View all tables in the schema
  • See column counts for each table
  • Review relationship statistics

3. Import to Canvas

Click "Import to Canvas" to add all tables to your flow diagram.

Tables will be:

  • Automatically arranged in a grid layout
  • Connected with arrows showing foreign key relationships
  • Fully interactive and editable

4. Edit Tables in UI

Select any database table in the canvas to open the properties panel:

Add Columns:

  • Click "Add" in the Columns section
  • Columns are created with default values

Edit Column Properties:

  • Click "Edit" on any column
  • Change name, data type, nullable status
  • Set or remove primary keys

Remove Columns:

  • Click the trash icon next to any column
  • The last column cannot be removed

View Relationships:

  • Primary Keys section shows all PK columns
  • Foreign Keys section shows all FK relationships

5. Edit SQL Directly

Click the Edit icon (pencil) on any source to:

  • View the generated SQL
  • Make changes directly in the SQL editor
  • Click the check mark to save changes
  • Cancel to discard changes

6. Regenerate SQL

Click the Regenerate icon (refresh) to:

  • Convert the current AST back to SQL
  • Includes all UI modifications
  • Preserves the original dialect
  • Updates the stored SQL content

Supported SQL Features

Table Structures

  • ✅ Tables with columns
  • ✅ Primary keys (single and composite)
  • ✅ Foreign keys with ON DELETE/UPDATE
  • ✅ Unique constraints
  • ✅ Check constraints
  • ✅ Indexes (single and composite)