SQL Diagram creation: Difference between revisions

From OpenPetra Wiki
Jump to navigation Jump to search
Line 28: Line 28:
** (I was not able to get the python plugin to work with dia on windows)
** (I was not able to get the python plugin to work with dia on windows)
* the discussion on the mailing list mentions [http://en.wikipedia.org/wiki/Force-based_algorithms Force based algorithms] for the positioning
* the discussion on the mailing list mentions [http://en.wikipedia.org/wiki/Force-based_algorithms Force based algorithms] for the positioning
So my approach to Task 2 would be to use some good algorithms when arranging the diagram, and make sure the generated diagram has the tables in the best position (most referenced tables in the centre, tables that are most linked to each other closest to each other), and the linking constraints are not crossing any tables, and are still possible to be read.

Revision as of 21:35, 3 June 2009

sql2diagram

We wrote this tool a while ago in C/C++ and uploaded it to sourceforge: http://sql2diagram.wiki.sourceforge.net/

functionality:

  • it reads the SQL tables and attributes from the SQL file with all the CREATE TABLE statements
  • it generates HTML documentation
  • it is able to generate diagrams for the DIA program (http://live.gnome.org/Dia)

The generation of the HTML documentation works fine.

diagrams

There are some problems with generating the diagrams. On the one hand it allows manual moving of the tables and connections in the dia editor, and the sql2diagram tool should pick up the manual positions and reuse them. But on the other hand, it is quite tedious to move the tables and foreign key constraints all by hand.

Task 1:

  • Use the new Database tools, instead of the ER shapes.

Task 2:

  • Do an automatic layout of the tables and connections.

Alternatives:

Some discussions and first hints:

So my approach to Task 2 would be to use some good algorithms when arranging the diagram, and make sure the generated diagram has the tables in the best position (most referenced tables in the centre, tables that are most linked to each other closest to each other), and the linking constraints are not crossing any tables, and are still possible to be read.