GithubHelp home page GithubHelp logo

schemaspy / schemaspy Goto Github PK

View Code? Open in Web Editor NEW
3.0K 47.0 304.0 61.41 MB

Database documentation built easy

Home Page: http://schemaspy.org

License: GNU Lesser General Public License v3.0

HTML 40.85% Java 36.89% JavaScript 17.92% CSS 2.53% Shell 0.02% Dockerfile 0.05% PLpgSQL 1.69% HCL 0.05%
schemaspy java documentation database database-schemas database-diagrams schema database-documentation database-document entity-relationship-diagram er-diagram reverse-engineering

schemaspy's Introduction

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

schemaspy's People

Contributors

abitrolly avatar actions-user avatar aisbergde avatar brianrepko avatar clintestwood avatar danwatt avatar dependabot[bot] avatar digitalbot avatar edumucelli avatar formerlychucks avatar francoiskha avatar igor-suhorukov avatar ismailsimsek avatar jesperolsson-se avatar jornh avatar jwstadler avatar kamyabnazari avatar mapausch avatar marcelstoer avatar martenbohlin avatar npetzall avatar osadi avatar rafalkasa avatar riggs333 avatar rmsiemens avatar samdus avatar ugultopu avatar vbro avatar vdaburon avatar wkasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

schemaspy's Issues

Don't use @Autowire in application classes

I propose that we move all wiring into @Configuration classes. Limit the ComponentScan to only scan a subpackage configuration.

In @Configuration class one would be free to use @Autowire.

Reason for this is to expose dependencies as constructor arguments which is easy to mock instead of private fields, classes will also not depend on spring.

Docker image?

Is there some "official" or recommended Docker image for SchemaSpy?

Cross-Schema Foreign Key not working with MSSQL

Connecting relationships..........16:58:37.313 WARNING: TableService.addForeignKey - Couldn't add FK 'FK_OTHER_fk_name' to table 'org.schemaspy.service.TableService@2784145d' - Column 'col' doesn't exist in table 'Table_In_dbo'
com.microsoft.sqlserver.jdbc.SQLServerException: The result set is closed.
	at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
	at com.microsoft.sqlserver.jdbc.SQLServerResultSet.checkClosed(SQLServerResultSet.java:372)
	at com.microsoft.sqlserver.jdbc.SQLServerResultSet.next(SQLServerResultSet.java:994)
	at org.schemaspy.service.TableService.connectForeignKeys(TableService.java:209)
	at org.schemaspy.service.DatabaseService.connectTables(DatabaseService.java:224)
	at org.schemaspy.service.DatabaseService.gatheringSchemaDetails(DatabaseService.java:64)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:231)
	at org.schemaspy.SchemaAnalyzer.analyzeMultipleSchemas(SchemaAnalyzer.java:129)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:82)
	at org.schemaspy.Main.main(Main.java:52)

graphviz version 2.26.0 not supported (while it should be according to documentation)

Thanks for taking up work on the original schemaSpy - looks great!

While it says that graphviz 2.26 or >2.31 are supported graphviz versions SchemaSpy does not accept 2.26.0:

0 $ java -jar ./schemaspy-6.0.0-rc1.jar -configFile sqlite.properties -o ndm_html -u $USER -meta ndm.meta.xml
Jun 13, 2017 5:15:38 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7cd84586: startup date [Tue Jun 13 17:15:38 CEST 2017]; root of context hierarchy
17:15:39.599 WARNING: Config.getPort - null
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.schemaspy.Config.getPort(Config.java:367)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.schemaspy.Config.populate(Config.java:1647)
	at org.schemaspy.Config.getRemainingParameters(Config.java:1465)
	at org.schemaspy.util.ConnectionURLBuilder.<init>(ConnectionURLBuilder.java:47)
	at org.schemaspy.service.SqlService.connect(SqlService.java:46)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
	at org.schemaspy.Main.main(Main.java:52)
17:15:39.646 WARNING: Config.getPort - null
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.schemaspy.Config.getPort(Config.java:367)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.schemaspy.Config.populate(Config.java:1647)
	at org.schemaspy.Config.getRemainingParameters(Config.java:1465)
	at org.schemaspy.util.ConnectionURLBuilder.<init>(ConnectionURLBuilder.java:53)
	at org.schemaspy.service.SqlService.connect(SqlService.java:46)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
	at org.schemaspy.Main.main(Main.java:52)
17:15:39.647 WARNING: Config.getPort - null
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.schemaspy.Config.getPort(Config.java:367)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.schemaspy.Config.populate(Config.java:1647)
	at org.schemaspy.Config.getRemainingParameters(Config.java:1465)
	at org.schemaspy.service.SqlService.connect(SqlService.java:50)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
	at org.schemaspy.Main.main(Main.java:52)
17:15:39.647 WARNING: Config.getPort - null
java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Integer.java:542)
	at java.lang.Integer.valueOf(Integer.java:766)
	at org.schemaspy.Config.getPort(Config.java:367)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.schemaspy.Config.populate(Config.java:1647)
	at org.schemaspy.Config.getRemainingParameters(Config.java:1465)
	at org.schemaspy.service.SqlService.connect(SqlService.java:52)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
	at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
	at org.schemaspy.Main.main(Main.java:52)
17:15:39.648 WARNING: SqlService.connect - Unrecognized option(s): -configFile sqlite.properties db /ae/data/tmp/hjoukl/ndm.db connectionSpec jdbc:sqlite:<db> description SQLite  driver org.sqlite.JDBC driverPath sqlite-jdbc-3.18.0.jar
Using database properties:
  /ae/data/pydev/hjoukl/tmp/ER_from_db/schemaspy/github_fork/sqlite.properties
Gathering schema details.....(0sec)
Connecting relationships.....(0sec)
Writing/graphing summary....
Warning: Invalid version of Graphviz dot detected (2.26.0).
   SchemaSpy requires dot graphvizVersion 2.26 or versions greater than 2.31. from www.graphviz.org.
   Generated pages will not contain a diagramatic view of table relationships.
......(1sec)
Writing/diagramming details.Table -> Deal
.Table -> DealCost
(0sec)
Wrote relationship details of 2 tables/views to directory 'ndm_html' in 3 seconds.
View the results by opening ndm_html/index.html
0  $ dot -V
dot - graphviz version 2.26.0 (20091210.2329)
0 $ 

As far as I know there is no such graphviz version "2.26" but only "2.26.0", at least of what I can tell from http://www.graphviz.org/pub/graphviz/ARCHIVE/

I suggest correcting the version string to 2.26.0 as the supported version (

private final GraphvizVersion supportedGraphvizVersion = new GraphvizVersion("2.26");
) or maybe adapting the regexp used to find the version from the dot -V command line to only consider the (major, minor) parts of the version.

If anyone has this issue and can't upgrade to a modern graphviz easily (e.g. corporate env) here's a hack: I'm currently tricking SchemaSpy into accepting 2.26.0 by using a dumb script:

$ cat bin/dot 
#!/bin/bash

MODIFIED_VERSION_OUTPUT="dot - graphviz version 2.26 (20091210.2329)"

if [ "$1" == "-V" ]; then
    >&2 echo "$MODIFIED_VERSION_OUTPUT"
else
    dot $@
fi

... and run the command with the -gv command line option to point to my (fake) graphviz installation dir:

$ java -jar ./schemaspy-6.0.0-rc1.jar -configFile sqlite.properties -o ndm_html -u $USER -meta ndm.meta.xml -gv /var/tmp/fake_graphviz # fake_graphviz contains bin/dot

unable to detect graphviz

I tried installing graphviz via homebrew and the .pkg distributed at http://www.graphviz.org/Download..php

Jun 06, 2017 5:57:57 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1b2c6ec2: startup date [Tue Jun 06 17:57:57 EDT 2017]; root of context hierarchy
Jun 06, 2017 5:57:57 PM org.schemaspy.Config loadProperties
INFO: Configuration file not found
Using database properties:
  [schemaspy-6.0.0-rc1.jar]/org/schemaspy/types/mssql05.properties
Gathering schema details.........................................................................................................................................................................................................(18sec)
Connecting relationships.........................................................................................................................................................................................................(8sec)
Writing/graphing summary.....dot -Tpng:gd outDir/diagrams/summary/relationships.real.compact.dot -outDir/diagrams/summary/relationships.real.compact.png -Tcmapx: Fontconfig error: Cannot load default config file
org.schemaspy.util.Dot$DotFailure: 'dot -Tpng:gd outDir/diagrams/summary/relationships.real.compact.dot -outDir/diagrams/summary/relationships.real.compact.png -Tcmapx' failed with return code 139
.dot -Tpng:gd outDir/diagrams/orphans/AdjustmentType.1degree.dot -outDir/diagrams/orphans/AdjustmentType.1degree.png -Tcmapx: Fontconfig error: Cannot load default config file
org.schemaspy.util.Dot$DotFailure: 'dot -Tpng:gd outDir/diagrams/orphans/AdjustmentType.1degree.dot -outDir/diagrams/orphans/AdjustmentType.1degree.png -Tcmapx' failed with return code 139
.....(5sec)

Support for Impala

(Copied from old sourceforge site)

Hi,
I tried to configure schemaspy to work against Impala, but after getting all the jdbc jars in place I hit a null pointer exception:

java.lang.ArrayIndexOutOfBoundsException: 1
at com.cloudera.hivecommon.core.CoreUtils.parseSubName(Unknown Source)
at com.cloudera.impala.jdbc41.Driver.parseSubName(Unknown Source)
at com.cloudera.jdbc.common.BaseConnectionFactory.acceptsURL(Unknown Source)
at com.cloudera.jdbc.common.AbstractDriver.connect(Unknown Source)
at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:582)
at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:157)
at net.sourceforge.schemaspy.Main.main(Main.java:42)

Any hints?

Thanks!
Dan

postgres auth fails

Firstly a big thank you for picking up this tool, its easily one of the most useful and underrated open source tools.

Now for my issue, I have a ssh tunnel going from the database to my laptop, this works great and connections are established client side using tools such as heidiSQL. So I am very confused when SchemaSpy gives me an auth error when trying to connect using the same credentials which I know are working in heidiSQL.

{ schemaspy }  » java -jar "C:\tools\schemaspy\schemaspy-6.0.0-beta.3.jar" -dp "C:\tools\schemaspy\drivers\postgres\postgresql-9.2-1004.jdbc41.jar" -t pgsql -db mydb -host 127.0.0.1 -port 1111 -u user -o "C:\tools\schemaspy\output" -p password
Feb 20, 2017 9:19:30 AM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@30dae81: startup date [Mon Feb 20 09:19:30 GMT 2017]; root of context hierarchy
Using database properties:
  [C:\tools\schemaspy\schemaspy-6.0.0-beta.3.jar]/org/schemaspy/types/pgsql.properties

Failed to connect to database URL [jdbc:postgresql://127.0.0.1/crm]

org.postgresql.util.PSQLException: FATAL: password authentication failed for user "crm_user"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:398)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
        at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
        at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
        at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
        at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
        at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
        at org.postgresql.Driver.makeConnection(Driver.java:397)
        at org.postgresql.Driver.connect(Driver.java:267)
        at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:66)
        at org.schemaspy.service.SqlService.connect(SqlService.java:65)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:194)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
        at org.schemaspy.Main.main(Main.java:52)

Any help is greatly appreciated, I'm on postgres v9.2.20

`-all` flag causes schemaspy to always exit non-zero code

class Main looks for a non-null return value to determine exit code.

rc = analyzer.analyze(new Config(argv)) == null ? 1 : 0;

rc = analyzer.analyze(new Config(argv)) == null ? 1 : 0;

However, when using the -all flag to analyze multiple schemas, null is always returned regardless of success.


This makes it difficult determine if schema generation was successful within CI.

Orphan Tables

Tested using schemaspy-6.0.0-beta.3.jar

  • Textual inconsistency
    • Navigation menus refers to it as Orphan Tables
    • Page heading refers to it as Orphans Tables
  • Views
    • Should this really be listing the views? (MySQL, not tested on other DB engines). Mentioned in #39

Great job so far guys, glad somethings being done.

Port definition in dbTypes is inconsistent

Some have and some expects PORT to be included in

description=MariaDB

connectionSpec=jdbc:mariadb://<host>:<port>/<db>
host=hostname host where database resides with optional port
db=database name
description=MySQL

connectionSpec=jdbc:mysql://<host>/<db>
host=hostname[:port] host where database resides with optional port
db=database name

Summary not showing

The nice summary shown in your sample doesn't show with my database.
Is there any configuration to tweak ?

Your sample:
2017-05-03 13_19_52-chinook database

My docs:
2017-05-03 13_18_56-zz_modelo_kernel database

I'm using a mysql database.

Remove built in swing UI?

Hi Rafal,

first of all: Great work! Thanks for keeping up and enhancing this project and putting up so much time and effort in it! 👍 :-)

Peeking into the source I noticed there is a small built in Swing GUI that can be started by using the -gui command line parameter (see https://github.com/schemaspy/schemaspy/blob/master/src/main/java/org/schemaspy/Main.java#L42).
I'm wondering if this feature is still needed.

There exists an advanced GUI using any Schemaspy JAR: http://schemaspygui.sourceforge.net/
(I tested it briefly with 6.0.0-rc1 - works fine.)

If we remove this built in GUI and delete the classes of the ui package https://github.com/schemaspy/schemaspy/tree/master/src/main/java/org/schemaspy/ui
we could focus more on the core functionality of Schemaspy.
In my opinion this would slim down the project.

Maybe you already have something like that in mind? I see there is a separate project https://github.com/schemaspy/schemaspygui

generate SVG instead of PNG images

All modern browsers will render SVG, and the images will be scalable and zoomable, and have pretty lines and arrows instead of the choppy ones rendered into the PNG images. I would request you consider rendering the images as SVG to take advantage of this. The only issue will be to make reference to the FK/PK images relative to the output directory so it works on a web browser.

Connecting to ms sql server

I'm running

» java -jar schemaSpy_5.0.0.jar -t mssql -db <my db> -u <my user> -host <ip address> -o <output dir> -dp sqljdbc42.jar -port <my port>
Using database properties:
  [schemaSpy_5.0.0.jar]/net/sourceforge/schemaspy/dbTypes/mssql.properties
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver

Failed to load driver 'com.microsoft.jdbc.sqlserver.SQLServerDriver'from: [file:/Users/harrymoreno/programming/databases/sqljdbc42.jar]
These entries don't point to valid files/directories: [C, /Program Files/Microsoft SQL Server 2000 Driver for JDBC/lib/msbase.jar;C, /Program Files/Microsoft SQL Server 2000 Driver for JDBC/lib/mssqlserver.jar;C, /Program Files/Microsoft SQL Server 2000 Driver for JDBC/lib/msutil.jar]

Use the -dp option to specify the location of the database
drivers for your database (usually in a .jar or .zip/.Z).

thoughts? I used the driver from https://www.microsoft.com/en-us/download/details.aspx?id=11774 using jre8 on mac

Use long for row count in meta data

https://sourceforge.net/p/schemaspy/bugs/191/

Yes, it is still a problem in the new beta.

Using database properties:
[schemaspy-6.0.0-beta.1.jar]/org/schemaspy/types/mysql.properties
Gathering schema details...java.lang.NumberFormatException: For input string: "2827140533"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:583)
at java.lang.Integer.parseInt(Integer.java:615)
at org.schemaspy.service.DatabaseService.getBasicTableMeta(DatabaseService.java:381)
at org.schemaspy.service.DatabaseService.initTables(DatabaseService.java:81)
at org.schemaspy.service.DatabaseService.gatheringSchemaDetails(DatabaseService.java:48)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:175)
at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:83)
at org.schemaspy.Main.main(Main.java:52)

Ignored port definition in properties file

Trying to generate diagram from database which port is different from default 5432, but doesn't matter, the error that I get in console is from port 5432:

Console

$ java -jar schemaspy6.jar -configFile schemaspy.properties

12:19:32.315 WARNING: Main.main - Connection Failure
org.schemaspy.model.ConnectionFailure: org.postgresql.util.PSQLException: Connection to database:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.

schemaspy.properties

schemaspy.t=pgsql
schemaspy.dp=/home/schemaspy/postgresql-42.0.0.jar
schemaspy.host=host
schemaspy.port=5444
schemaspy.db=database
schemaspy.u=user
schemaspy.p=root
schemaspy.o=/home/schemaspy/generated

DriverPath and LoadJDBCJars

-dp takes a string, it can be either a single lib or list of libs separated by File.pathSeparator.

There is an option -loadjars which will load sibling libs, however this only works when -dp is set to a single lib.

I would propose that driver path (-dp) can be used with:

  • Single library: just load that file
  • List of paths to libraries: load only these files/directories
  • Directory: load all libraries in that directory

and thus remove the -loadjars option from command-line

A tiny hack would be that -loadjars only operate on the first lib found in -dp

Unable to find layout/schemaSpy.css

Writing or graphing the summary out fails with the error message

Unable to find requested file schemaspy-6.0.0-beta.2.jar!\layout\schemaSpy.css

WARNING exception in DbAnalyzerTest when schemaspy.properties is missing

Running org.schemaspy.DbAnalyzerTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.966 sec
Running org.schemaspy.ConfigTest
Mar 09, 2017 6:11:09 AM org.schemaspy.Config loadProperties
WARNING: schemaspy.properties (No such file or directory)
java.io.FileNotFoundException: schemaspy.properties (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at org.schemaspy.Config.loadProperties(Config.java:1622)
at org.schemaspy.Config.fixupArgs(Config.java:1595)
at org.schemaspy.Config.(Config.java:141)
at org.schemaspy.ConfigTest.testConfig(ConfigTest.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Support for Amazon Redshift database

Redshift is compatible to some extent with postgres driver, unfortunately at some point, schemaspy throws the following exception:

Connecting relationships....14:57:15.152 SEVERE:  Main.main - Unable to determine a value for MaxIndexKeys due to missing system catalog data.
org.postgresql.util.PSQLException: Unable to determine a value for MaxIndexKeys due to missing system catalog data.
        at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getMaxIndexKeys(AbstractJdbc2DatabaseMetaData.java:64)
        at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedExportedKeys(AbstractJdbc2DatabaseMetaData.java:3196)
        at org.postgresql.jdbc2.AbstractJdbc2DatabaseMetaData.getImportedKeys(AbstractJdbc2DatabaseMetaData.java:3526)
        at org.schemaspy.service.TableService.connectForeignKeys(TableService.java:207)
        at org.schemaspy.service.DatabaseService.connectTables(DatabaseService.java:224)
        at org.schemaspy.service.DatabaseService.gatheringSchemaDetails(DatabaseService.java:64)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:234)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
        at org.schemaspy.Main.main(Main.java:52)

There is a dedicated JDBC driver for redshift (https://docs.aws.amazon.com/redshift/latest/mgmt/configure-jdbc-connection.html), but it cannot be used in place of postgresql driver, due to different class naming.

add option to ignore inherited tables

In Postgres, I use table inheritance to implement partitions to keep each individual table small. This grossly complicates the schema with nearly zero added benefit to understanding the relations. I would appreciate an option to have such tables removed from the summary diagrams at least. Right now I manually edit them out and re-draw my images using dot.

For my purposes I could exclude them using a pattern match.

Deep linking anchors

Having anchors on the different sections on the pages generated for tables so you could make deep links to e.g. #relationships would be very neat 👍 .... aaand useful too I think.

To not visually clutter up the very nice new page UI the anchors could just reveal themselves when you hovered over a section title, similar to the way it works with titles in Markdown text here on Github.

Backwards Compatibility: Number of things missing

Really great that the work is now continuing on schemaspy!

I just generated the database report and saw that several things are missing:

  1. There is now a pagination mechanism and there is no way to be view everything on one page like in the 5.X. version. Or did I miss something? Certainly a question of taste however the 'everything on one page' really helped us for some overview matters and it would be nice to still have that option...

  2. Additionally the culmulated number of rows and columns are missing (cp. screenshot) Which is quite important to us. The number of colums I can see in the column tab however rows seems to be completely gone. This was originally my request because in the old version I got an overflow in the datatype since MAX_INTEGER range was probably crossed and I got a neg. value...

  3. Orphaned Tables (previously Utility Tables): Would it be possible to add an option to exclude the views and only show real tables? (like it is possible in some of the other tabs)

  4. Anomalies: I miss the "Columns that are flagged as both 'nullable' and 'must be unique'" option. Was it removed for a specifc reasion?

schemaspy

uppercase in db user name

It looks like schemaspy send db user name in uppercase, even when I set it in lowercase.
my db configfile contains:
schemaspy.u="uzytkownik"

After trying to run there is error:
org.schemaspy.model.ConnectionFailure: org.netezza.error.NzSQLException: LDAP authentication failed for user 'UZYTKOWNIK'

-template parametter ignored with jar-binary package

with following line template parameter is ignored when running program isJarFile.

/schemaspy/src/main/java/org/schemaspy/view/MustacheWriter.java

    private String getTemplatePath(String templatePath) {
        String path = "layout/"+templatePath; // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        if (!Config.getInstance().isJarFile()) {
            path = new File(templateDirectory,templatePath).getPath();
        }
        return path;
    }

MariaDB 5.5.x support?

I use MariaDB (not Oracle MySQL) and can't connect. Password works with mysql client (in .my.cnf hardcoded) and has no special characters, only alphanum.

I use RHEL7 VM.

# /usr/java/jre1.8.0_77/bin/java -jar /root/tmp/schemaspy-6.0.0-rc1.jar
Apr 21, 2017 3:56:32 PM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@30dae81: startup date [Fri Apr 21 15:56:32 CEST 2017]; root of context hierarchy
Using database properties:
  [/root/tmp/schemaspy-6.0.0-rc1.jar]/org/schemaspy/types/mysql.properties

Failed to connect to database URL [jdbc:mysql://localhost:3306/sbmongodb]

java.sql.SQLException: Invalid authorization specification message from server: "Access denied for user 'root'@'127.0.0.1' (using password: YES)"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1907)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:2524)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:818)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
        at com.mysql.jdbc.Connection.<init>(Connection.java:452)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
        at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:66)
        at org.schemaspy.service.SqlService.connect(SqlService.java:65)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
        at org.schemaspy.Main.main(Main.java:52)
15:56:33.543 WARNING: Main.main - Connection Failure
org.schemaspy.model.ConnectionFailure: java.sql.SQLException: Invalid authorization specification message from server: "Access denied for user 'root'@'127.0.0.1' (using password: YES)"
        at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:92)
        at org.schemaspy.service.SqlService.connect(SqlService.java:65)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
        at org.schemaspy.Main.main(Main.java:52)
Caused by: java.sql.SQLException: Invalid authorization specification message from server: "Access denied for user 'root'@'127.0.0.1' (using password: YES)"
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1907)
        at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:2524)
        at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:818)
        at com.mysql.jdbc.Connection.createNewIO(Connection.java:1808)
        at com.mysql.jdbc.Connection.<init>(Connection.java:452)
        at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
        at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:66)
        ... 4 more

# cat schemaspy.properties
# type of database. Run with -dbhelp for details
schemaspy.t=mysql
# optional path to alternative jdbc drivers.
schemaspy.dp=/root/tmp/mysql-connector-java-5.1.41/mysql-connector-java-5.1.41-bin.jar
# database properties: host, port number, name user, password
schemaspy.host=localhost
schemaspy.port=3306
schemaspy.db=mysql
schemaspy.u=root
schemaspy.p=rootroot
# output dir to save generated files
schemaspy.o=/root/tmp/sbmongodb
# db scheme for which generate diagrams
schemaspy.s=sbmongodb

I suspect a problem with Oracle MySQL JDBC and tried MariaDB JDBC connector

/usr/java/jre1.8.0_77/bin/java -jar /root/tmp/schemaspy-6.0.0-rc1.jar
Apr 24, 2017 10:23:26 AM org.springframework.context.annotation.AnnotationConfigApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@30dae81: startup date [Mon Apr 24 10:23:26 CEST 2017]; root of context hierarchy
Using database properties:
  [/root/tmp/schemaspy-6.0.0-rc1.jar]/org/schemaspy/types/mysql.properties
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

Failed to load driver 'com.mysql.jdbc.Driver' from: [file:/root/tmp/mariadb-java-client-1.5.9.jar]
This entry doesn't point to a valid file/directory: [/mysql/mysql-connector-java-5.1.6-bin.jar]

Use the -dp option to specify the location of the database
drivers for your database (usually in a .jar or .zip/.Z).

10:23:26.770 WARNING: Main.main - Connection Failure
org.schemaspy.model.ConnectionFailure: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at org.schemaspy.DbDriverLoader.getDriver(DbDriverLoader.java:145)
        at org.schemaspy.DbDriverLoader.getConnection(DbDriverLoader.java:54)
        at org.schemaspy.service.SqlService.connect(SqlService.java:65)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:197)
        at org.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:86)
        at org.schemaspy.Main.main(Main.java:52)
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at org.schemaspy.DbDriverLoader.getDriver(DbDriverLoader.java:120)
        ... 5 more

Specifying the renderer

Thank you for taking up maintenance of the SchemaSpy project. I've been using it for a few years, and it definitely needs some finishing up.

A recent update to graphviz seems to have broken it for me on OSX. I thought I'd try your version to see if it fixes the issue, but it suffers from the same problem. When generating a diagram, we get errors like these:

 .net.sourceforge.schemaspy.util.Dot$DotFailure: 'dot -Tpng:gd /Users/stebro/build/scan_priority.1degree.dot -o/Users/stebro/build/scan_priority.1degree.png -Tcmapx' failed with return code 139

Running that command directly from the command line also fails (with a segfault). Talking to the graphviz guys, it turns out there's something not right about the gd rendering library on our machines, but SchemaSpy works correctly with the cairo renderer, so this command succeeds:

dot -Tpng /Users/stebro/build/scan_priority.1degree.dot -o/Users/stebro/build/scan_priority.1degree.png -Tcmapx

(note the absence of :gd on the -T flag). I'm not a java developer, but in scanning through the code (Config.java) it looks like theres an option, "-renderer", that governs the behavior of what goes into the -T option, but I cannot get it to work, e.g., invoking schemaspy with -renderer png", "-renderer cairo" or "-renderer png:cairo" doesn't do anything (but doesn't give me an error for an unknown command line option).

Any ideas?

Table column comments not appearing

I have comments on columns in my Oracle database. SchemaSpy 5.0 has picked them up correctly, but 6.0.0-rc1 does not, they appear blank in the html output. I am running on exactly the same schema and DB, the only change is the jar file used, and the issue is repeatable, i.e. occurs in 100% of the cases.
I am running against Oracle 12c, using the thin driver. My Java version is 1.8.0_131-b11.
Output on V5:
image

Output on V6:
image

Clicking the Comments buttons shows/hides the column for comments, but the column is still empty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.