Skip to content

schemaspy/schemaspy

Repository files navigation

Logotype

Maven Central Docker Pulls Development Documentation Status Quality Gate Coverage Gitter

SchemaSpy is a database metadata analyzer. It helps your database administrators and developers visualize, navigate and understand your data model. With an easy-to-use HTML-based report, traversing the entity-relationship diagram has never been simpler. Our product showcase is available at http://schemaspy.org/sample/index.html.

SchemaSpy sample

Installation

SchemaSpy is a standalone application without GUI. Just download the latest JAR file or Docker image and you're ready to go! To use SchemaSpy from Maven, please see the Maven chapter below.

# replace '6.2.4' with latest version
curl -L https://github.com/schemaspy/schemaspy/releases/download/v6.2.4/schemaspy-6.2.4.jar \
    --output ~/Downloads/schemaspy.jar

For unreleased bug fixes and features-in-progress, download our snapshot JAR or use Docker tag snapshot

Maven

SchemaSpy releases two types of JAR files: a bare-bone JAR and a fat JAR including all dependencies. Both JARs are published to Maven Central. The fat JAR is also attached to releases on GitHub. The "maven central" badge at the top of this page will take you straight to the latest version on Maven Central.

The Maven GAV of the two artifacts is as follows:

  • bare-bone JAR: org.schemaspy:schemaspy:<version>
  • fat JAR: org.schemaspy:schemaspy:<version>:app ← note the app classifier

Quick start

Let's assume you're using PostgreSQL (11 or later). First, download their JDBC driver.

curl -L https://jdbc.postgresql.org/download/postgresql-42.5.4.jar \
    --output ~/Downloads/jdbc-driver.jar

Then run SchemaSpy against your database and you're ready to browse it in DIRECTORY/index.html.

java -jar ~/Downloads/schemaspy.jar \
    -t pgsql11 \
    -dp ~/Downloads/jdbc-driver.jar \
    -db DATABASE \
    -host SERVER \
    -port 5432 \
    -u USER \
    -p PASSWORD \
    -o DIRECTORY

If you aren't using PostgreSQL, don't panic! Out of the box, SchemaSpy supports over a dozen different databases. List them by using -dbhelp. Still not enough? As long as your database has a JDBC driver you can plug it in to SchemaSpy.

Documentation and FAQs

We host our documentation on Read the Docs. Be sure to check out the section on troubleshooting common problems.

Main use cases

SchemaSpy covers a lot of use cases for database analysis and documentation. Be sure to check out the guides provided by the community later in this README.

On-demand database documentation

The preferred way to document databases is through entity-relationship (ER) diagrams. However, drawing these diagrams manually is such a time-consuming and error-prone process that we hardly ever draw them in practice. When the diagrams are drawn, they rarely stay up-to-date. With SchemaSpy, this is no longer a problem. The diagrams can be generated quickly and even as a part of your CI/CD workflow to ensure it's always up to date.

Your database in numbers

SchemaSpy can collect various kinds of interesting statistics to describe the shape and form of your database's structure. Drill down deeper into these statistics directly in the report or export them to excel or CSV for further QA analysis.

Keep the data confidential

Nowadays, a company's data can be their most valuable asset. Since SchemaSpy only reads structural information, it works just as well on an empty database replica. This means that the report can be shared for third party analysis without fear.

Detect sub-optimal constructs

SchemaSpy incorporates knowledge about best practices in database design. It can locate and report anomalies such as missing indexes, implied relationships, and orphan tables.

Community

Welcome to the SchemaSpy community! Just reading this file or using the tool means that you're a part of our community and contributing to the future of the project. We're grateful to have you with us!

Some of our community members have put extra effort into sharing SchemaSpy with more people, asked their companies to provide financial aid, or decided to improve the software. We wish we had the space to thank each of you individually because every Github star, tweet or other activity reminds us that our work is appreciated.

Special thanks

For creating the first five versions of SchemaSpy:

For perpetuating SchemaSpy ever since:

For creating tutorials and guides for the community:

Scientific usage

We are proud to note that SchemaSpy assists researchers in their work.

To cite SchemaSpy, please use:

SchemaSpy Team (2024) SchemaSpy: Database documentation built easy. SchemaSpy. URL https://schemaspy.org/

The BibTeX entry for LaTeX users is:

@Manual{schemaspy,
  title = {SchemaSpy: Database documentation built easy},
  author = {{SchemaSpy Team}},
  organization = {SchemaSpy},
  year = {2024},
  url = {https://schemaspy.org/}
}

Build Instructions

Application

SchemaSpy is built using maven and we utilize the maven wrapper.
Windows mvnw.cmd package
Linux ./mvnw package
The resulting application can be found in target

Analyzing

You need your own SonarQube:
https://hub.docker.com/_/sonarqube/
Windows mvnw.cmd -P sonar clean verify -Dsonar.host.url=http://$(boot2docker ip):9000 -Dsonar.jdbc.url="jdbc:h2:tcp://$(boot2docker ip)/sonar"
Linux ./mvnw -P sonar clean verify

Watch results at:
Linux http://localhost:9000
Windows http://$(boot2docker ip):9000

Documentation

Built using Python
Create venv
Install dependencies pip install -r docs/requirements.txt
Navigate into docs
Windows make.bat clean && make.bat html
Linux make clean html
The resulting documentation can be found in docs/build/html