Module SQLDependencyGrapher
In: lib/sql_dep_grapher.rb
SQLDependencyGrapher Module: SQLDependencyGrapher

SQLDependencyGrapher allows you to visualize the query dependencies between your database tables to better understand how they actually get used. It generates a graph of the connections between tables based on joins found in a SQL query log.

To generate a graph, you run the sql_dep_graph command whiche creates a dot file that you can render with Graphviz or OmniGraffle.


  sql_dep_graph log/production.log >

  dot -Tpng > sql_deps.png

Then open sql_deps.png in your favorite image viewer.

You can find Graphviz here:

And can download it for various platforms from here:



VERSION = '1.0.0'   The Version of SQLDependencyGrapher

Public Class methods

Builds a Graph from a SQL query log given to stream.