1SQLT-GRAPH(1) User Contributed Perl Documentation SQLT-GRAPH(1)
2
3
4
6 sqlt-graph - Automatically create a graph from a database schema
7
9 ./sqlt-graph -d⎪--db⎪-f⎪--from=db_parser [options] schema.sql
10
11 Options:
12
13 -l⎪--layout Layout schema for GraphViz
14 ("dot," "neato," "twopi"; default "dot")
15 -n⎪--node-shape Shape of the nodes ("record," "plaintext,"
16 "ellipse," "circle," "egg," "triangle," "box,"
17 "diamond," "trapezium," "parallelogram," "house,"
18 "hexagon," "octagon," default "record")
19 -o⎪--output Output file name (default STDOUT)
20 -t⎪--output-type Output file type ("canon", "text," "ps," "hpgl,"
21 "pcl," "mif," "pic," "gd," "gd2," "gif," "jpeg,"
22 "png," "wbmp," "cmap," "ismap," "imap," "vrml,"
23 "vtx," "mp," "fig," "svg," "plain," default "png")
24 -c⎪--color Add colors
25 --no-fields Don't show field names
26 --height Image height (in inches, default "11",
27 set to "0" to undefine)
28 --width Image width (in inches, default "8.5",
29 set to "0" to undefine)
30 --fontsize custom font size for node and edge labels
31 --fontname name of custom font (or full path to font file) for
32 node, edge, and graph labels
33 --nodeattr attribute name and value (in key=val syntax) for
34 nodes; this option may be repeated to specify
35 multiple node attributes
36 --edgeattr same as --nodeattr, but for edge attributes
37 --graphattr same as --nodeattr, but for graph attributes
38 --natural-join Perform natural joins
39 --natural-join-pk Perform natural joins from primary keys only
40 --show-datatypes Show datatype of each field
41 --show-sizes Show column sizes for VARCHAR and CHAR fields
42 --show-constraints Show list of constraints for each field
43 -s⎪--skip Fields to skip in natural joins
44 --debug Print debugging information
45
47 This script will create a graph of your schema. Only the database
48 driver argument (for SQL::Translator) is required. If no output file
49 name is given, then image will be printed to STDOUT, so you should re‐
50 direct the output into a file.
51
52 The default action is to assume the presence of foreign key relation‐
53 ships defined via "REFERNCES" or "FOREIGN KEY" constraints on the
54 tables. If you are parsing the schema of a file that does not have
55 these, you will find the natural join options helpful. With natural
56 joins, like-named fields will be considered foreign keys. This can
57 prove too permissive, however, as you probably don't want a field
58 called "name" to be considered a foreign key, so you could include it
59 in the "skip" option, and all fields called "name" will be excluded
60 from natural joins. A more efficient method, however, might be to sim‐
61 ply deduce the foriegn keys from primary keys to other fields named the
62 same in other tables. Use the "natural-join-pk" option to acheive
63 this.
64
65 If the schema defines foreign keys, then the graph produced will be
66 directed showing the direction of the relationship. If the foreign
67 keys are intuited via natural joins, the graph will be undirected.
68
70 Ken Y. Clark <kclark@cpan.org>.
71
73 perl, SQL::Translator.
74
75
76
77perl v5.8.8 2007-10-24 SQLT-GRAPH(1)