views:

3508

answers:

5

Note: Originally this question was asked for PostgreSQL, however, the answer applies to almost any database which has a JDBC driver that can detect foreign-key associations.


Querying PostgreSQL data dictionary for foreign-keys and relationship between tables is very straightforward, but how can I use that information to generate a graph of the relations between tables?

Any recommendations about tools that can do this?

EDIT: I know GraphVIZ/DOT can be useful, however, I don't know have any idea regarding how to code an app that would generate the directed graph .DOT file.

+3  A: 

Microsoft Visio will easily do this.

Andrew
A: 

Dot is multiplatform and may be useful.

Plz send me the code?
Camilo Díaz
+4  A: 

Dot is part of the graphviz package, which is a pretty damn cool/useful tool. Of course, you'll need something to generate the dot files for graphviz. I've used SchemaSpy once or twice in the past, and it works pretty well, provided you have the relationships defined in the database.

Paul Wicks
Yay, SchemaSpy looks like the right tool for the job! Thanks :)
Camilo Díaz
A: 

This question is very similar to this one:

http://stackoverflow.com/questions/117774/decipher-database-schema#117919

and some of the answers over there might help you.

AJ
+2  A: 

SchemaBank might be useful if you don't want to install anything as they are web-based. Just open an account there, feed in your database dump and check / edit the reverse-engineered schema on your web browser.

Leigh Pyle