Do you have an existing database model you would like to work with in Vertabelo? If so, you've come to the right place!
In this article, you learn how to export a DDL file from MySQL Workbench and import it into our modeling tool. We also take a look at other ways to import an existing database schema into Vertabelo and organize existing tables.
How to Export a DDL File From MySQL Workbench
First, let's see how to export an existing database. Open MySQL Workbench, then select Server -> Data Export from the menu at the top.
Next, choose the schema to be exported (in our example, it is demo) and the objects to export (here, we have chosen all tables). In Export Options, you may choose to export each table to a separate file or all selected objects into a single file. When everything is ready, click Start Export at the bottom.
You see the progress of your export. If everything goes well, you see the message “Export completed”.
How to Import an Existing Database Schema Into Vertabelo
There are various ways to import an existing database schema into Vertabelo. One is to use the Vertabelo Reverse Engineering Tool. Use this tool to connect to a database and export the model data to an XML file. Later, you may import the XML file into Vertabelo.
How to Create a Database Model From an SQL DDL File in Vertabelo
Another way is to import a model from an SQL DDL file in Vertabelo. Let's see how to do this with the SQL script exported from MySQL Workbench.
You may import the SQL file while creating a new document. First, open your drive. Then, on the menu bar at the top, click this icon to create a new document. A new window appears. Click the Create button next to Physical data model.
Next, type the name of the model and choose the database engine. Scroll down to the Content section and choose From SQL.
Click Browse to choose a file from your computer. After choosing the file, click Import SQL. Then, click Start modeling.
You see the imported model in the diagram area.
Alternatively, open the model and click on the three-dot menu at the top of the screen. Next, click Import and Import from SQL. Note that there is also an option to import an XML file generated by Vertabelo Reverse Engineering Tool or exported from Vertabelo.
A new window appears. Click Browse to add a file from your computer. You may add the imported objects to the current model or overwrite the existing model.
Once the file is uploaded, verify the DDL script and modify it if needed. Alternatively, copy and paste the SQL script instead of uploading it from your computer. When you’re ready, click Parse & import.
You see a window informing you that the import has finished. The imported model is visible in the diagram area.
How to Organize the Imported Model Using Vertabelo Features
Once you have imported your model, you may use Vertabelo to organize the tables. Let’s take a look at some of the available options.
Subject Areas
Subject areas are handy if you have a huge database with many tables. This feature allows you to group model elements according to their functions.
To add a new area, either click the Add new area button in the menu bar at the top or press 7 on your keyboard. Then, click and hold the left button on your mouse and drag the cursor to draw a box around all of the elements you want in your area.
For example, we may create a Purchase area to group the tables related to purchases.
Table Shortcuts
A shortcut table is a copy of a table created to reduce complexity. This results in fewer overlapping lines and makes the diagram more readable.
Create shortcut tables by right-clicking on a table name in the Model structure panel on the left. Then click Add shortcut table.
You see this creates a copy of the original table.
Notes
You may add notes to your diagram to document certain parts of the model or create to-do lists. To add a new note, either click the Add new note button in the menu bar at the top or press 6 on your keyboard.
Then, click anywhere in the model to create a note.
Table Colors
Instead of using subject areas, you may also use different colors to group elements of a model. To do so, click on the element and scroll to the Format section of the Properties panel on the right.
You may color tables, views, and subject areas.
Ready to Create Database Models From SQL?
That's all for today! You have learned how to import an existing database schema into Vertabelo and organize your model. To find out more about creating a great diagram layout, make sure to read Part 2 – How to Organize a Large Database Diagram and 7 Tips for a Good ER Diagram Layout on our blog!