Diagram Generator

TablePlus Plugin by

Tags:

, ,

TablePlus Diagram Generator plugin is one of the most feature-rich plugins that help you generate diagrams from databases, model them, see connections between tables, and export them to SQL statements.

Technically, this plugin allows you to generate ERD.

What is ERD (or ED)?

ERD stands for Entity Relationship Diagram, or Entity Diagram.

An ERD is a visual representation used in database design to illustrate the relationships between entities within a system. It helps in mapping out the structure of data by defining entities (such as tables), their attributes (fields), and the connections (relationships) between them.

ERDs are essential for understanding the data flow, ensuring data integrity, and designing a database that accurately reflects the real-world scenarios it aims to model. They typically use standardized symbols like rectangles for entities, ovals for attributes, and diamonds for relationships, making complex data structures easier to comprehend and manage.

How to use

  1. Open a database connection.
  2. Right-click on any table inside your database.
  3. Hover over the Generate Diagram menu item and select what you want to do.

Menu option “Empty Diagram”

If you select “Empty Diagram” – a new window will open that will NOT have your current database being loaded. You will start with an empty canvas to build the diagram from scratch.

In this case one of the most important buttons for you will be the + Table button. It will add a table on a canvas that you can then fill it with columns, types, etc.:

TablePlus Diagram - Empty

By the way, this mode of the plugin is also available from the TablePlus app top-level “Plugins” menu.

Menu option “Generate Diagram”

This is the main mode of this plugin. In this mode you see your whole database being generated and put on a canvas with all the keys being connected, all columns, indexes, etc.

This is the most useful way to see how tables are connected.

TablePlus Diagram Interface

Menu option “Generate Diagram selected Items”

This odd menu item name needs clarification. When you right-click on a table and select this menu item – all that specific table will appear on the newly opened diagram canvas. There will be no other tables.

This mode is very similar to the “Structure” view you can open for any table. In the screenshot below you can see both “Structure” (at the top) and diagram (at the bottom) opened side by side.

TablePlus Diagram Selected Table

Additional TablePlus Diagram Plugin Features

Because this is basically a separate JS app loaded inside the TablePlus context, you can do quite a lot of other things.

Import Diagrams

TablePlus Diagram Import

If you already used this feature in the past, it will be handy for you to import your previous work.

If you are new to this TablePlus plugin, you can load one of the predefined example databases, like the one below – airlines sample.

TablePlus Diagram Import Airlines

But you can also import any other exported diagrams that you saved before. So technically, in this plugin, you can model your database, export it in a special file format supported by this app, and then even store it in Git if you want. At any given time import it again to continue fiddling with it and configuring it as needed.

Export Diagrams

The main idea of the plugin is to model the database, and after you are done – you can export the result of your hard work in one of the supported formats. And there are plenty of them:

TablePlus Diagram Export

“Save to file” allows you to export the database to the *.diagram file type. Here is an example export file from the airlines-related screenshot above. Technically, this is just a regular JSON file with a different file extension.

“Copy to clipboard” is the same as above minus the file – you will have all the JSON stored in the clipboard.

“Save as PNG” (high or low quality) or SVG is self-explanatory. I would like to warn you that the SVG file will be quite big – for that airlines.diagram file that you can download above (or see the picture above), the file size will be 1.8 MB. PNG in high quality will be a 3-times smaller file.

The most interesting is the “Export to databases” menu items. So far exporting diagrams into these databases is supported:

  • MySQL
  • MariaDB
  • SQLite
  • PostgreSQL
  • Cassandra
  • Snowflake
  • Microsoft SQL Server

The result .sql file will have all the CREATE statements to use as a starting point for your development.

Diagrams Switcher

TablePlus Diagram Switcher

The Diagrams Switcher is your Workspaces. Every database you open, and every new diagram you start creating is displayed here as a separate workspace. They are separated from each other, and you can switch between them at any point without losing your progress (unless you close your Diagram window).

You can duplicate and delete them. Saving to a file and copying to a clipboard does the same thing as the same Export menu items.

Other smaller features

As you might have already spotted on various screenshots, there are some other features available for you, like:

  • Undo and Redo buttons for your changes on the canvas.
  • “Search” for a table by its name – which will focus the canvas on the one you need right now. Very helpful when the database is huge and does not fit your viewport.
  • “Arrange” allows you to perform these self-explanatory actions:
    • Expand all columns and Arrange
    • Collapse columns and Arrange
  • “Zoom” is helpful when you have a ton of tables and want to have a bird-eye view of a bunch of them. I even used it several times for screenshots.

Is the TablePlus Diagram plugin up-to-date?

Technically this TablePlus plugin is a bit outdated compared to its sister web service created by the same TablePlus team – Diagram by TablePlus. So if you want to use the latest version of this functionality to build database diagrams, you might wish to start using their service.


TablePlus Build (min)

330

Category

,

Leave a Reply

Your email address will not be published. Required fields are marked *