SQL::Translator::Producer::GraphViz(3pm) User Contributed Perl Documentation SQL::Translator::Producer::GraphViz(3pm)

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

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

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!

All GraphViz constructor attributes are accepted and passed through to "new" in GraphViz. The following defaults are assumed for some attributes:

  layout => 'dot',
  overlap => 'false',
  node => {
    shape => 'record',
    style => 'filled',
    fillcolor => 'white',
  },
  # in inches
  width => 8.5,
  height => 11,

See the documentation of "new" in GraphViz for more info on these and other attributes.

In addition this producer accepts the following arguments:

  • node_shape

    Deprecated, use node => { shape => ... } instead

  • add_color

    Deprecated, use bgcolor => 'lightgoldenrodyellow' instead

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

  • nodeattrs

    Deprecated, use node => { ... } instead

  • edgeattrs

    Deprecated, use edge => { ... } instead

  • graphattrs

    Deprecated, use graph => { ... } instead

Ken Youens-Clark <kclark@cpan.org>

Jonathan Yu <frequency@cpan.org>

SQL::Translator, GraphViz

2024-01-20 perl v5.38.2