1SQL::Translator::ProducUesre:r:GCroanpthrViibzu(t3e)d PeSrQlL:D:oTcruamnesnltaattoiro:n:Producer::GraphViz(3)
2
3
4
6 SQL::Translator::Producer::GraphViz - GraphViz producer for
7 SQL::Translator
8
10 use SQL::Translator;
11
12 my $trans = SQL::Translator->new(
13 from => 'MySQL', # or your db of choice
14 to => 'GraphViz',
15 producer_args => {
16 out_file => 'schema.png',
17 bgcolor => 'lightgoldenrodyellow',
18 show_constraints => 1,
19 show_datatypes => 1,
20 show_sizes => 1
21 }
22 ) or die SQL::Translator->error;
23
24 $trans->translate or die $trans->error;
25
27 Creates a graph of a schema using the amazing graphviz (see
28 http://www.graphviz.org/) application (via the GraphViz module). It's
29 nifty--you should try it!
30
32 All GraphViz constructor attributes are accepted and passed through to
33 "new" in GraphViz. The following defaults are assumed for some
34 attributes:
35
36 layout => 'dot',
37 overlap => 'false',
38
39 node => {
40 shape => 'record',
41 style => 'filled',
42 fillcolor => 'white',
43 },
44
45 # in inches
46 width => 8.5,
47 height => 11,
48
49 See the documentation of "new" in GraphViz for more info on these and
50 other attributes.
51
52 In addition this producer accepts the following arguments:
53
54 • skip_tables
55
56 An arrayref or a comma-separated list of table names that should be
57 skipped. Note that a skipped table node may still appear if another
58 table has foreign key constraints pointing to the skipped table. If
59 this happens no table field/index information will be included.
60
61 • skip_tables_like
62
63 An arrayref or a comma-separated list of regular expressions
64 matching table names that should be skipped.
65
66 • cluster
67
68 Clustering of tables allows you to group and box tables according
69 to function or domain or whatever criteria you choose. The syntax
70 for clustering tables is:
71
72 cluster => 'cluster1=table1,table2;cluster2=table3,table4'
73
74 Or pass it as an arrayref like so:
75
76 cluster => [ 'cluster1=table1,table2', 'cluster2=table3,table4' ]
77
78 Or like so:
79
80 cluster => [
81 { name => 'cluster1', tables => [ 'table1', 'table2' ] },
82 { name => 'cluster2', tables => [ 'table3', 'table4' ] },
83 ]
84
85 • out_file
86
87 The name of the file where the resulting GraphViz output will be
88 written. Alternatively an open filehandle can be supplied. If
89 undefined (the default) - the result is returned as a string.
90
91 • output_type (DEFAULT: 'png')
92
93 This determines which output method will be invoked to generate the
94 graph: "png" translates to "as_png", "ps" to "as_ps" and so on.
95
96 • fontname
97
98 This sets the global font name (or full path to font file) for
99 node, edge, and graph labels
100
101 • fontsize
102
103 This sets the global font size for node and edge labels (note that
104 arbitrarily large sizes may be ignored due to page size or graph
105 size constraints)
106
107 • show_fields (DEFAULT: true)
108
109 If set to a true value, the names of the columns in a table will be
110 displayed in each table's node
111
112 • show_fk_only
113
114 If set to a true value, only columns which are foreign keys will be
115 displayed in each table's node
116
117 • show_datatypes
118
119 If set to a true value, the datatype of each column will be
120 displayed next to each column's name; this option will have no
121 effect if the value of "show_fields" is set to false
122
123 • friendly_ints
124
125 If set to a true value, each integer type field will be displayed
126 as a tinyint, smallint, integer or bigint depending on the field's
127 associated size parameter. This only applies for the "integer" type
128 (and not the "int" type, which is always assumed to be a 32-bit
129 integer); this option will have no effect if the value of
130 "show_fields" is set to false
131
132 • friendly_ints_extended
133
134 If set to a true value, the friendly ints displayed will take into
135 account the non-standard types, 'tinyint' and 'mediumint' (which,
136 as far as I am aware, is only implemented in MySQL)
137
138 • show_sizes
139
140 If set to a true value, the size (in bytes) of each CHAR and
141 VARCHAR column will be displayed in parentheses next to the
142 column's name; this option will have no effect if the value of
143 "show_fields" is set to false
144
145 • show_constraints
146
147 If set to a true value, a field's constraints (i.e., its primary-
148 key-ness, its foreign-key-ness and/or its uniqueness) will appear
149 as a comma-separated list in brackets next to the field's name;
150 this option will have no effect if the value of "show_fields" is
151 set to false
152
153 • show_indexes
154
155 If set to a true value, each record will also show the indexes set
156 on each table. It describes the index types along with which
157 columns are included in the index.
158
159 • show_index_names (DEFAULT: true)
160
161 If "show_indexes" is set to a true value, then the value of this
162 parameter determines whether or not to print names of indexes. if
163 "show_index_names" is false, then a list of indexed columns will
164 appear below the field list. Otherwise, it will be a list prefixed
165 with the name of each index.
166
167 • natural_join
168
169 If set to a true value, "make_natural_joins" in
170 SQL::Translator::Schema will be called before generating the graph.
171
172 • join_pk_only
173
174 The value of this option will be passed as the value of the like-
175 named argument to "make_natural_joins" in SQL::Translator::Schema;
176 implies "natural_join => 1"
177
178 • skip_fields
179
180 The value of this option will be passed as the value of the like-
181 named argument to "make_natural_joins" in SQL::Translator::Schema;
182 implies "natural_join => 1"
183
184 DEPRECATED ARGS
185 • node_shape
186
187 Deprecated, use node => { shape => ... } instead
188
189 • add_color
190
191 Deprecated, use bgcolor => 'lightgoldenrodyellow' instead
192
193 If set to a true value, the graphic will have a background color of
194 'lightgoldenrodyellow'; otherwise the default white background will
195 be used
196
197 • nodeattrs
198
199 Deprecated, use node => { ... } instead
200
201 • edgeattrs
202
203 Deprecated, use edge => { ... } instead
204
205 • graphattrs
206
207 Deprecated, use graph => { ... } instead
208
210 Ken Youens-Clark <kclark@cpan.org>
211
212 Jonathan Yu <frequency@cpan.org>
213
215 SQL::Translator, GraphViz
216
217
218
219perl v5.32.1 2021-01S-Q2L7::Translator::Producer::GraphViz(3)