© 2003, 2004 by Jarno Elonen
Download sql2diagram-sxd 1.0.5 [GPG sig] | Read the source code
Sql2diagram-sxd is a free Python
tool for reverse engineering ERD (Entity-Relationship Diagrams) and to
generate UML-style table structure diagrams from SQL CREATE
statements that contain appropriate FOREIGN KEY
specifications.
The program outputs OpenOffice.org Draw
(.sxd) files, so the results are editable.
It is Free Software / Open Source, licensed under the GNU General Public License.
In fact, you generally have to edit the results manually because the the program doesn't do any kind of intelligent layouting: if you have more than a few foreign keys, the result will be a messy mesh that you have untangle by hand before the diagram is of any practical use. See the "Generated" screenshots.
The program can also output a machine readable textual explanation (examples: ER, table struct.) of the diagram it is writing, which you might want to try and convert to other diagram formats as well.
To build sql2diagram-sxd
, you have to run sql2diagram-sxd.g
through yapps2. The makefile usually does this automatically but
here's how to do it manually, in case you have to:
$ python yapps2/yapps2.py sql2diagram-sxd.g $ cp yapps2/yappsrt.py ./ $ chmod a+x sql2diagram-sxd.py $ sql2diagram-sxd.py --help
The SQL parser was originally written for MySQL but has been verified to cover at least basic PostgreSQL as well. It is based on YAPPS2 parser generator by Amit J. Patel.
sxd-template.sxd
is a template file that the program uses for
generating the SXD files. Don't touch it unless you really know
what you are doing - in particular, don't try to modify it with OOo,
it will most likely not work after that. If you are still curious,
however, try unzipping it (yes, OOo documents are actually ZIPs) and
look into content.xml
.
Please note I have currently no further development plans for this program. For me, it has done it's job for now. If you find it useful, I would welcome contributions in form of patches or even brances.
(This page and images on it count as documentation of the software and are thus under the same license as the program itself.)