SchemaCrawler Database Diagramming
SchemaCrawler is unique among database diagramming tools in that you do not need to know the table names or column names that you are interested in. All you need is a search expression, in the form of a regular expression. SchemaCrawler has powerful command-line options to match tables, and then find other related tables, whether they are parent or child tables. If your schema changes, you can simply regenerate the diagram, without having to know the exact changes that were made.
To use generate SchemaCrawler diagrams, for install Graphviz. Then you can run SchemaCrawler with the correct command-line options - for example, -command graph -outputformat png -outputfile=graph.png See the diagram example in the SchemaCrawler examples download. An example of a SchemaCrawler database diagram is below.
You can provide additional GraphViz command-line options using the SC_GRAPHVIZ_OPTS environmental variable, or pass in the additional arguments using the SC_GRAPHVIZ_OPTS Java system property. SchemaCrawler does not set the dpi, or resolution of generated graphs. A useful GraphViz command-line option to set is -Gdpi=300.
You can decide whether foreign-key names, column ordinal numbers, and schema names are displayed by setting the following properties in the SchemaCrawler configuration file, schemacrawler.config.properties.
schemacrawler.format.show_ordinal_numbers=true schemacrawler.format.hide_foreignkey_names=true schemacrawler.format.show_unqualified_names=true
For more details, see the diagram example in the SchemaCrawler examples download.
SchemaCrawler offers several options to change what you see on the database diagram. Here are a few variations:
- Suppress schema names and foreign key names, using the -portablenames command-line option.
- Show significant columns, such as primary and foreign key columns, and columns that are part of unique indexes. Use the -infolevel=standard -command=briefcommand-line option.
- Show column ordinals, by setting configuration option schemacrawler.format.show_ordinal_numbers=true in the configuration file.
- Display columns in alphabetical order, using the -sortcolumns command-line option.
- Grep for columns, and also display outgoing relationships, using -grepcolumns=.*\\.BOOKS\\..*\\.ID as a command-line option.
- Grep for columns, but only show matching tables, using -grepcolumns=.\.BOOKS\..\.ID and -only-matching as command-line options.
- Do not show cardinality on the diagrams, to avoid clutter. Set configuration option schemacrawler.graph.show.primarykey.cardinality=false and schemacrawler.graph.show.foreignkey.cardinality=false in the configuration file.
Schemacrawler database diagrams in use at the Scrum meeting at the Software Development Departement of La Ville de Nouméa. Photograph courtesy of Adrien Sales.