Weston Ruter

Web application developer in Portland, Oregon

SchemaGraph: Visualizing Complex Databases

Graph visualization of a MySQL database with the tables placed around a circle and the foreign key constraints appearing as lines between the tables SchemaGraph is a MySQL database schema visualization tool inspired by Schemaball. Recently I've been working on a personal project that has a complex schema structure; it has many tables and dozens of foreign key constraints among them. I need a tool which displays all of the tables at once and all of the interrelationships among them so that I can keep track of what is going on. I would have used Schemaball instead of developing a new solution, but I found a couple disadvantages with Schemaball: it generates static raster images when I wanted a dynamic vector images, and its requirements include several dependencies on Perl modules which can be a hassle to install. I really liked the format that Schemaball used to visualize a database schema, but I just wanted to have a standalone script which I could place on a web server, point it at a database, and have it generate an interactive SVG image. To use with future projects at Shepherd Interactive, I wanted maximum portability and minimal configuration with immediate results.

SchemaGraph, like Schemaball, queries the MySQL information_schema database to get all of the necessary information about a database's (InnoDB) tables to construct a graph; this graph is then output as an interactive SVG image (see example) with the following features:

To use this tool, simply place schemagraph.php on a web server and provide values for the constants needed to establish the database connection. You may also modify the constants for the circle radius, font size, and image dimensions. Since the script outputs plain SVG with inline CSS and JavaScript, you may further customize it as needed to get the desired style or behavior.

The code is released under the GNU General Public License 2.0.

The source is located at: http://shepherd-interactive.googlecode.com/svn/trunk/schemagraph/

One Comment

  1. SchemaGraph: Visualizing Databases in SVG | Weston Ruter

    [...] just released SchemaGraph, a tool which queries the MySQL information_schema database to get all of the necessary information [...]

Leave a Comment