skip to main content

SQL Schema importer

This tool allows SQL scripts to be quickly imported into the engine and is capable of recognizing classes, attributes, relationships, integrity constraints, and more; it is a modeling shortcut that allows you to use pre-existing database structures, regenerating them from DDL commands produced by an SQL dump.

List of supported SQL dialects

Importing a .sql file into the engine #

From the Designer, click Tools on the top bar and choose the Import SQL Schema option from the drop-down menu. From the Import SQL into model panel, click on the first icon at the top left, select the desired .sql file, and click on the button Import SQL .

Importarting an .sql file

SQL Schema importer

The SQL Schema Importer

The SQL Schema Importer panel allows you to import and edit any supported .sql file.

At any time, you can check the validity of the SQL script by clicking the Validate button. If parsing is successful, the message SQL script appears to be valid appears. If not, the parser highlights the line on which the compilation error is present, and you must manually intervene on the file to remove the SQL construct is not supported.

Newly created classes will be visible in a new diagram within the engine

When the data type of an attribute is not supported, it is marked as unknown and a message appears in the Designer alerting the user to the error. In order for the model to be saved, all unrecognized data types must be changed manually by the user.

Download Structure MySQL

By importing a .sql file more than once, the Designer automatically resolves conflicts by renaming duplicate elements appropriately (e.g., if you import a Class table twice, it will become Class_1 in the diagram created during the second import.

Dumping a SQL Schema from the Dashboard

Example #

Let’s now look at an application scenario for this tool. To get started, download the example .sql file by clicking on the button below:

SQL-Importer-example.sql

Download Structure MySQL

Graphical representation of the .sql script used in this example

This script defines a SQL Schema in which there are three tables with references to foreign keys. For the attributes within the classes, the Importer correctly recognizes both integrity constraints and unique constraints.

SQL Schema importer

The example .sql file as it appears in the SQL Schema Importer panel

Before proceeding with the import, verify that the file you downloaded is free of errors by pressing the Validate button.

Valid SQL script

Once you press Import SQL , the The selected classes and relations have been successfully imported in the current model message appears and a new diagram is created in the engine, with within it the classes and relationships shown in the following image:

Download Structure MySQL

The diagram generated by importing the example file into the engine