Matt Langtree

Entity Relationship Diagrams From Sequel Pro

I found a great set of instructions for generating an Entity Relationship Diagram (ERD) from Sequel Pro indirectly (using the .dot format) in this article: http://norbauer.com/notebooks/code/notes/erd-diagrams-from-sequel-pro

I adapted the instructions that JD posted in his article to generate a PNG image of the ERD of a database.

Here are the instructions in full:

  • Download the latest version of Sequel Pro
  • Install graphviz via homebrew (note - sudo isn’t required for my installation of homebrew). brew install graphviz
  • Connect to your MySQL database using Sequel Pro.
  • In Sequel Pro, go to File > Export… > Choose Dot as the export type > Export.
  • Launch Terminal.app and run the following command from the directory where the .dot file was exported to dot -Tpng your_database.dot > your_database.png 
  • I found that on a larger database that this produced a 5355 × 3784px image (which is probably great for printing out on A3 paper)
  • I was looking for an ERD I could print out to pass around to some other developers, so I opted for the fdp binary to give me the best results. Again in Terminal.app run: fdp -Tpng localhost-ios-15-11-11.dot > your_database.png 

My instructions vary from JD’s a little in that I use homebrew for installing graphviz and that I export using a different binary (included in the graphviz package). I also took the shortcut of exporting to PNG directly rather than converting to an SVG file first.