Import and Parse SQL
Open the DDLBuilder workspace and follow the import steps below. After importing related tables, check their foreign keys and ER diagram, then generate ORM models.
This guide explains how to reverse-engineer existing SQL scripts, batch DDL statements, or structured data files (CSV, Excel, JSON Schema) into editable schema models.
Overview
Accelerate migrations, legacy system refactoring, and data dictionary ingestion by importing existing schemas rather than typing column definitions from scratch.
Operations Walkthrough
1. Single and Multi-Table SQL Reverse-Engineering
DDLBuilder uses a secure three-step "Validate → Preview → Confirm" workflow:
- Click the Import SQL button in the top navigation bar.
- Select the Source Database Dialect and paste your SQL script (supports single or multiple
CREATE TABLE,CREATE INDEX,ALTER TABLE, andGRANTstatements). - Click "Next" to validate syntax and parse schema structures.
- Inspect and Refine in the Preview Panel:
- Verify extracted columns, data types, primary keys, indexes, and privilege grants.
- Reorder columns by dragging handles or delete unwanted columns directly within the preview modal.
- For multi-table imports, DDLBuilder detects name collisions and offers merge strategies: Overwrite, Skip, or Auto-Rename.
- Click "Confirm Import" to apply changes atomically to the workspace. If the source SQL contains namespace identifiers (e.g.,
CREATE TABLE sales.orders), the system splitssalesintoSchema NameandordersintoTable Name.
2. Structured Data File Imports (CSV / Excel / JSON Schema)
For actual order records or customer lists, use Business Data Import. CSV / Excel imports on this page read field-definition lists.
- Click Import Data in the top navigation and choose your file format:
- CSV Files: Reads field-definition lists: headers identify field name, SQL type and comment; each following row describes a field.
- Excel Spreadsheets (.xlsx / .xls): Reads field definitions from each worksheet, including names, explicit SQL types and comments.
- JSON Schema: Extracts
propertiesfields, types, formats, and descriptions.
- Upload your file, review inferred data types in the preview table, and manually adjust any column mappings if necessary.
- Confirm the import to populate your workspace with the extracted columns.
Supported Formats and Parser Behavior
| Source / Format | Supported Constructs & Specifications | Parser Behavior |
|---|---|---|
| SQL Scripts | CREATE TABLE, CREATE INDEX, ALTER TABLE, GRANT | Extracts constraints, defaults, comments, composite indexes, and grants |
| CSV Files | UTF-8 encoded, comma-delimited, header row | Reads field names, explicit SQL types and comments |
| Excel Files | Standard .xlsx and .xls workbooks | Reads field-definition lists from worksheets |
| JSON Schema | Draft-07 / 2020-12 compliant schemas | Maps properties (string, integer, boolean, number) to database columns |
Verification Checklist
- [ ] Workspace accurately reflects imported table names, columns, constraints, and indexes.
- [ ] Qualified schema prefixes are correctly separated into
Schema NameandTable Name. - [ ] The output panel generates valid, clean DDL and DCL for your target dialect.
Tips and Troubleshooting
Dialect Mismatch Check
If the parser reports a syntax error, confirm that the Source Database Dialect in the import modal matches the SQL's actual syntax (e.g., using an Oracle script with a MySQL parser).
- Splitting Large Scripts: For massive SQL dump files containing dozens of tables, split scripts by business domain to maintain optimal browser parsing responsiveness.
- Encoding and Protection: Ensure CSV files are encoded in UTF-8. Remove password encryption on Excel spreadsheets prior to upload.
- Nested JSON Schemas: Deeply nested JSON schemas should be simplified or flattened to reflect relational table entities before importing.