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.

Usage:

  sql_dep_graph log/production.log > sql_deps.dot

  dot -Tpng sql_deps.dot > sql_deps.png

Then open sql_deps.png in your favorite image viewer.

You can find Graphviz here:

www.graphviz.org/

And can download it for various platforms from here:

www.graphviz.org/Download.php

Methods

Constants

VERSION = '1.0.0'   The Version of SQLDependencyGrapher

Public Class methods

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

[Validate]