===============
Sql2diagram-sxd
===============

version 1.0.5, 2004-03-02

Release notes:

  + this version contains a slightly patched version
    of yapps2, to make it case insensitive. I will release
    1.1.0 once yapps2 has the feature. The changes are
    available in ``yapps2-case-insens.patch``

  + The build gives a warning about rule "single_col". Please
    ignore it for now - the parser works correctly despite it.

Introduction
============

``Sql2diagram-sxd`` is a Python program for reverse engineering
ER (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.

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.

The program can also output a machine readable textual explanation
of the diagram it is writing which you might want to try and convert
to other diagram formats as well.

The SQL parser was originally written for MySQL but has been extended
to work with at least basic PostgreSQL syntax. May work with other formats
as well. It is based on YAPPS2 parser generator by Amit J. Patel.

Build
=====

To build ``sql2diagram-sxd``, you have to process ``sql2diagram-sxd.g``
through ``yapps2``. The makefile usually does this automatically but
here's how to do it manually::

 $ python yapps2/yapps2.py -fcase-insensitive sql2diagram-sxd.g
 $ cp yapps2/yappsrt.py ./
 $ chmod a+x sql2diagram-sxd.py
 $ sql2diagram-sxd.py --help

Notes
=====

"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".

``sql2diagram-sxd`` is copyright (C) 2003 by Jarno Elonen <elonen@iki.fi>
It is licensed under the GNU General Public License.
See COPYING for details.
