SQLT-GRAPH(1)

πŸ’… NAME πŸ’…

sqlt-graph(1) β€” a User Contributed Perl Documentation page that will Automatically create a graph from a database schema. Bestie, it's literally giving β€œschema but make it visual” ✨.

✨ SYNOPSIS ✨

./sqlt-graph -d|--db|-f|--from=db_parser [options] schema.sql

πŸŽ€ Options πŸŽ€

  • -l, --layout β€” picks the GraphViz layout for your schema: "dot", "neato", or "twopi"; default is "dot".
  • -n, --node-shape β€” shape of the nodes: "record", "plaintext", "ellipse", "circle", "egg", "triangle", "box", "diamond", "trapezium", "parallelogram", "house", "hexagon", "octagon"; default is "record".
  • -o, --output β€” output file name; default is STDOUT.
  • -t, --output-type β€” output file type: "canon", "text", "ps", "hpgl", "pcl", "mif", "pic", "gd", "gd2", "gif", "jpeg", "png", "wbmp", "cmap", "ismap", "imap", "vrml", "vtx", "mp", "fig", "svg", "plain"; default is "png".
  • -c, --color β€” add colors.
  • --cluster β€” cluster tables.
  • --no-fields β€” don't show field names.
  • --height β€” image height (in inches, default "11", set to "0" to undefine).
  • --width β€” image width (in inches, default "8.5", set to "0" to undefine).
  • --fontsize β€” custom font size for node and edge labels.
  • --fontname β€” name of custom font (or full path to font file) for node, edge, and graph labels.
  • --nodeattr β€” attribute name and value (in key=val syntax) for nodes; this option may be repeated to specify multiple node attributes.
  • --edgeattr β€” same as --nodeattr, but for edge attributes.
  • --graphattr β€” same as --nodeattr, but for graph attributes.
  • --natural-join β€” perform natural joins.
  • --natural-join-pk β€” perform natural joins from primary keys only.
  • --show-datatypes β€” show datatype of each field.
  • --show-sizes β€” show column sizes for VARCHAR and CHAR fields.
  • --show-constraints β€” show list of constraints for each field.
  • -s, --skip β€” fields to skip in natural joins.
  • --skip-tables β€” comma-separated list of table names to exclude.
  • --skip-tables-like β€” comma-separated list of regexen to exclude tables.
  • --debug β€” print debugging information.
  • --trace β€” print parser trace info.

🌸 DESCRIPTION 🌸

Okay so this script will create a graph of your schema. Only the database driver argument (for SQL::Translator) is required. If no output file name is given, then the image will be printed to STDOUT, so you should redirect the output into a file. No cap, that's the whole flow. 🫢

The default action is to assume the presence of foreign key relationships defined via REFERNCES or FOREIGN KEY constraints on the tables. (Yes, REFERNCES is spelled like that in the original β€” we keep it moving. πŸ’…) If you are parsing the schema of a file that does not have these, you will find the natural join options helpful.

With natural joins, like-named fields will be considered foreign keys. This can prove too permissive, however, as you probably don't want a field called name to be considered a foreign key, so you could include it in the skip option, and all fields called name will be excluded from natural joins. A more efficient method, however, might be to simply deduce the foreign keys from primary keys to other fields named the same in other tables. Use the natural-join-pk option to achieve this. Slay. ✨

If the schema defines foreign keys, then the graph produced will be directed showing the direction of the relationship. If the foreign keys are intuited via natural joins, the graph will be undirected.

Clustering of tables allows you to group and box tables according to function or domain or whatever criteria you choose. The syntax for clustering tables is:

  cluster1=table1,table2;cluster2=table3,table4

🫢 AUTHOR 🫢

Ken Youens-Clark <kclark@cpan.org>. That's the icon behind this one. πŸ’–

🌈 SEE ALSO 🌈

  • perl
  • SQL::Translator

Bye bestie 🫢 this page is from perl v5.40.2, dated 2026-07-16, and it's SQLT-GRAPH(1) β€” periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from