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 --cluster Cluster tables
26 --no-fields Don't show field names
27 --height Image height (in inches, default "11",
28 set to "0" to undefine)
29 --width Image width (in inches, default "8.5",
30 set to "0" to undefine)
31 --fontsize custom font size for node and edge labels
32 --fontname name of custom font (or full path to font file) for
33 node, edge, and graph labels
34 --nodeattr attribute name and value (in key=val syntax) for
35 nodes; this option may be repeated to specify
36 multiple node attributes
37 --edgeattr same as --nodeattr, but for edge attributes
38 --graphattr same as --nodeattr, but for graph attributes
39 --natural-join Perform natural joins
40 --natural-join-pk Perform natural joins from primary keys only
41 --show-datatypes Show datatype of each field
42 --show-sizes Show column sizes for VARCHAR and CHAR fields
43 --show-constraints Show list of constraints for each field
44 -s|--skip Fields to skip in natural joins
45 --skip-tables Comma-separated list of table names to exclude
46 --skip-tables-like Comma-separated list of regexen to exclude tables
47 --debug Print debugging information
48 --trace Print parser trace info
49
51 This script will create a graph of your schema. Only the database
52 driver argument (for SQL::Translator) is required. If no output file
53 name is given, then image will be printed to STDOUT, so you should
54 redirect the output into a file.
55
56 The default action is to assume the presence of foreign key
57 relationships defined via "REFERNCES" or "FOREIGN KEY" constraints on
58 the tables. If you are parsing the schema of a file that does not have
59 these, you will find the natural join options helpful. With natural
60 joins, like-named fields will be considered foreign keys. This can
61 prove too permissive, however, as you probably don't want a field
62 called "name" to be considered a foreign key, so you could include it
63 in the "skip" option, and all fields called "name" will be excluded
64 from natural joins. A more efficient method, however, might be to
65 simply deduce the foreign keys from primary keys to other fields named
66 the same in other tables. Use the "natural-join-pk" option to achieve
67 this.
68
69 If the schema defines foreign keys, then the graph produced will be
70 directed showing the direction of the relationship. If the foreign
71 keys are intuited via natural joins, the graph will be undirected.
72
73 Clustering of tables allows you to group and box tables according to
74 function or domain or whatever criteria you choose. The syntax for
75 clustering tables is:
76
77 cluster1=table1,table2;cluster2=table3,table4
78
80 Ken Youens-Clark <kclark@cpan.org>.
81
83 perl, SQL::Translator.
84
85
86
87perl v5.36.0 2023-02-27 SQLT-GRAPH(1)