Schemacrawler logo

SchemaCrawler

Free database schema discovery and comprehension tool

SchemaCrawler Examples

Before running any example, follow the steps in Getting Started with SchemaCrawler Examples to set up Docker, start a database, and verify your connection.

Choose an example by task. The How-to recipes provide step-by-step guidance, while the feature references explain each capability.

Explore and visualize

See the command-line recipe, diagramming guide, and schema search reference.

Example Description
Command-Line Explore and document database schemas directly from the shell command line.
Diagram Generate visual entity-relationship diagrams using Graphviz, in PNG, PDF, SVG, and other formats.
Other Diagrams Produce Mermaid, DBML, and PlantUML entity-relationship diagrams using Python scripts.
Grep Search a database schema for tables, columns, and routine parameters matching a regular expression.
Dump Export the full contents of a database in a diff-able HTML format for comparison across environments.

Analyze and improve

See the lint configuration recipe, SchemaCrawler Lint reference, and implicit associations reference.

Example Description
Lint Identify potential database design issues such as missing primary keys, missing indexes, and naming inconsistencies.
Implicit Associations Define logical foreign key relationships between tables that are not enforced at the database level.

Document and export

Compare output formats, serialization, and offline snapshots.

Example Description
Serialize Export a full database schema to JSON or YAML for offline analysis or integration with other tools.
Offline Snapshot Save a database schema snapshot and reconnect to it later without needing the original database.
Attributes Enrich your schema with remarks and custom metadata loaded from a YAML file.
User Defined Queries Execute custom per-table SQL queries using SchemaCrawler template variables.
Database-Specific Queries Run SQL specific to a particular database engine using named query commands.

Customize and integrate

Follow the scripting and output recipes and consult the scripting reference.

Example Description
JavaScript Scripting Script against live database metadata using JavaScript, with access to the catalog and a live JDBC connection.
Python Scripting Script against live database metadata using Python, with access to the catalog and a live JDBC connection.
Apache Velocity Templating Generate custom text output from your database schema using Apache Velocity templates.
Mustache Templating Generate custom text output from your database schema using logic-less Mustache templates.
Thymeleaf Templating Generate HTML output from your database schema using Thymeleaf natural templates.
Chain Run multiple SchemaCrawler commands in sequence from a single JavaScript script in one database pass.