The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SQL::Translator::Producer::GraphViz - GraphViz producer for SQL::Translator

SYNOPSIS

  use SQL::Translator;

  my $trans = new SQL::Translator(
      from => 'MySQL',            # or your db of choice
      to => 'GraphViz',
      producer_args => {
          out_file => 'schema.png',
          add_color => 1,
          show_constraints => 1,
          show_datatypes => 1,
          show_col_sizes => 1
      }
  ) or die SQL::Translator->error;

  $trans->translate or die $trans->error;

DESCRIPTION

Creates a graph of a schema using the amazing graphviz (see http://www.graphviz.org/) application (via the GraphViz module). It's nifty--you should try it!

PRODUCER ARGS

  • out_file

    the name of the file where the graphviz graphic is to be written

  • layout (DEFAULT: 'dot')

    determines which layout algorithm GraphViz will use; possible values are 'dot' (the default GraphViz layout for directed graph layouts), 'neato' (for undirected graph layouts - spring model) or 'twopi' (for undirected graph layouts - circular)

  • node_shape (DEFAULT: 'record')

    sets the node shape of each table in the graph; this can be one of 'record', 'plaintext', 'ellipse', 'circle', 'egg', 'triangle', 'box', 'diamond', 'trapezium', 'parallelogram', 'house', 'hexagon', or 'octagon'

  • output_type (DEFAULT: 'png')

    sets the file type of the output graphic; possible values are 'ps', 'hpgl', 'pcl', 'mif', 'pic', 'gd', 'gd2', 'gif', 'jpeg', 'png', 'wbmp', 'cmap', 'ismap', 'imap', 'vrml', 'vtx', 'mp', 'fig', 'svg', 'canon', 'plain' or 'text' (see GraphViz for details on each of these)

  • width (DEFAULT: 8.5)

    width (in inches) of the output graphic

  • height (DEFAULT: 11)

    height (in inches) of the output grahic

  • show_fields (DEFAULT: true)

    if set to a true value, the names of the colums in a table will be displayed in each table's node

  • show_fk_only

    if set to a true value, only columns which are foreign keys will be displayed in each table's node

  • show_datatypes

    if set to a true value, the datatype of each column will be displayed next to each column's name; this option will have no effect if the value of show_fields is set to false

  • show_col_sizes

    if set to a true value, the size (in bytes) of each CHAR and VARCHAR column will be displayed in parentheses next to the column's name; this option will have no effect if the value of show_fields is set to false

  • show_constraints

    if set to a true value, a field's constraints (i.e., its primary-key-ness, its foreign-key-ness and/or its uniqueness) will appear as a comma-separated list in brackets next to the field's name; this option will have no effect if the value of show_fields is set to false

  • add_color

    if set to a true value, the graphic will have a background color of 'lightgoldenrodyellow'; otherwise the background color will be white

  • natural_join

    if set to a true value, the make_natural_join method of SQL::Translator::Schema will be called before generating the graph; a true value for join_pk_only (see below) implies a true value for this option

  • join_pk_only

    the value of this option will be passed as the value of the like-named argument in the make_natural_join method (see natural_join above) of SQL::Translator::Schema, if either the value of this option or the natural_join option is set to true

  • skip_fields

    the value of this option will be passed as the value of the like-named argument in the make_natural_join method (see natural_join above) of SQL::Translator::Schema, if either the natural_join or join_pk_only options has a true value

AUTHOR

Ken Y. Clark <kclark@cpan.org>

SEE ALSO

SQL::Translator, GraphViz