Schemacrawler logo


Free database schema discovery and comprehension tool


SchemaCrawler is a free database schema discovery and comprehension tool. SchemaCrawler has a good mix of useful features for data governance. You can search for database schema objects using regular expressions, and output the schema and data in a readable text format. The output serves for database documentation, and is designed to be diff-ed against other database schemas. SchemaCrawler also generates schema diagrams. You can execute scripts in any standard scripting language against your database. You can find potential schema design issues with lint.

SchemaCrawler supports almost any database that has a JDBC driver, but for convenience is bundled with drivers for some commonly used RDBMS systems. SchemaCrawler works with any operating system that supports Java SE 8 or better.

GitHub Repo stars Quick Build Integration Tests codecov

The Central Repository Main distribution Docker Pulls Chocolatey Scoop

SchemaCrawler Command-line

SchemaCrawler comes with a set of command-line tools that allow database metadata to be output as plain text, HTML5, HTML5 with embedded diagrams, JavaScript object notation (JSON) or YAML. The HTML5 output is a combination of valid XML (that can be manipulated by XML tools or XSLT), and HTML that can be viewed in a browser. All formats are designed to be easy to diff, or find differences with other schemas that may have been output in the same format.

SchemaCrawler has grep functionality that allows you to search for table and column names using regular expressions. SchemaCrawler is capable of creating entity-relationship diagrams in DOT format, which Graphviz can convert into schema diagrams. SchemaCrawler has powerful scripting ability, using JavaScript, Groovy, Ruby or Python. A live connection is provided to the script context to allow you to select from or even modify your database. Examples are provided for all of these with the download.

SchemaCrawler is integrated with templating engines, such as Apache Velocity, Thymeleaf, Apache <#FreeMarker> and Mustache. You can write templates to generate SQL scripts or any other text output. However, you will need to download the templating engine separately, since these are not part of the SchemaCrawler download.

Explore the SchemaCrawler command-line with a live online tutorial. The tutorial works from within any browser with no software or plugins needed.

SchemaCrawler API

SchemaCrawler is also a Java API that makes working with database metadata as easy as working with plain old Java objects. Java programmers need to access database metadata

Programmers can obtain database metadata using JDBC, but with the raw JDBC API database metadata is returned as result sets, not Java objects. Also, programmers are still responsible for managing resources, mapping into object structures, and handling exceptions. This makes using the JDBC API very cumbersome when it comes to metadata. Furthermore, the JDBC API is not very consistent. For example, to find the type of a table, you would look at the TABLE_TYPE , which has a string value, but for procedures, PROCEDURE_TYPE is an integer. An another example, is the getCatalogs() call, which returns a result set with exactly one column, in contrast to getStringFunctions() which returns a string containing the list of function names, separated by commas.

SchemaCrawler attempts to solve some of these problems by providing an API that is consistent and usable. Database metadata is provided in the form of plain old Java objects (POJOs). Some examples of the consistency and usability of the SchemaCrawler API are that:

SchemaCrawler goes beyond what is available using JDBC, and can provide information on database triggers, sequences and synonyms as well.

SchemaCrawler is free and open-source API, available under a number of licenses. SchemaCrawler is written in Java, making it operating system agnostic. Since it leverages JDBC, it is also database independent. It deliberately doesn’t have any RDBMS-specific code. SchemaCrawler allows you to compare structures between two different database servers, or even two different database systems, from different vendors.

SchemaCrawler provides metadata for the following database objects:

The sample code below demonstrates just how easy it is to use SchemaCrawler. For more example code, take a look at the examples project. For more details, please refer to the javadocs.

More code examples are at [Code Examples Using the SchemaCrawler API](code-examples.html).


SchemaCrawler is grateful to