1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
<html>
<body>
<h1>tedia2sql 1.2.8</h1>
<h2>What is tedia2sql?</h2>
It is a tool that allows you to create a database ERD in
<a href="http://lysator.liu.se/~alla/dia">Dia</a>
(using the UML shape toolset), then to convert that ERD into a
SQL DDL script for multiple databases. Traditionally, to be
able to do these things, you've needed to have a Win32 OS
installed. But because Dia is available for Unices, and because
my Perl script works on Unices, this means that you can now
create ERDs that generate SQL DDL for your database -- all
without ever rebooting into Win32! The best part is, if you're
stuck using Win32, tedia2sql will <strong>still</strong> work for you,
because it has been modified to run under popular Win32
Perl environments (even non-Cygwin environments, although
Cygwin will naturally work).
<h2>Help Me Add Database Support to tedia2sql</h2>
You do not need to be a Perl coder to code support for new
databases! A good working knowledge of the SQL DDL for the
flavour you're interested in, and merely a cursory knowledge of
C (or Perl or Java or any C-like language) should be all you
need. Please actually look at the source code and see if you
can understand it. You might be surprised.
<p>
If all that still makes you too nervous, just allow me to send
you a SQL script generated by tedia2sql and run it against a
test database, and report back errors.
<h2>Short History of tedia2sql</h2>
I originally named tedia2sql "dia2sql" -- a mistake. There was
already a script called dia2sql by Alexander Troppman and
tedia2sql has almost nothing to do with the original dia2sql,
which you can probably tell by reviewing the source. It is
also incompatible with the original dia2sql in that Dia UML
diagrams you've created won't result in the same SQL DDL you'd
have gotten from dia2sql.
<h2>Prerequisites for tedia2sql</h2> (get from <a href="http://rpmfind.net">RPM Find dot Net</a>)
<ul>
<li> Dia 0.90 or newer (0.88.1 has a known problem with component stereotypes)
<li> expat-1.95.3 (search <a href="http://rpmfind.net">RPM Find</a> for libexpat)
<li> Perl XML::Parser (search <a href="http://search.cpan.org">CPAN</a> for xml::parser)
<li> Perl XML::RegExp (search <a href="http://search.cpan.org">CPAN</a> for xml::regexp)
<li> Perl XML::DOM (search <a href="http://search.cpan.org">CPAN</a> for xml::dom)
<li> Perl Digest::MD5 (most Perl installations should include this already)
</ul>
If you are running Debian/Linux, BSD, or any of the apt-based
OSen, this should be as simple as:
<pre>
# apt-get install libxml-perl
# apt-get install libxml-dom-perl
</pre>
<p>
If you're running the unstable or testing builds of Debian, you
can even just do this:
<pre>
# apt-get install tedia2sql
</pre>
Many thanks to the Debian maintainers and enthusiasts for doing this.
I had to do almost nothing to get into Debian, and this is a great
boon to DBAs.
<h2>Database Support:</h2>
<ul>
<li> Sybase support: <strong>95% Done</strong> (missing trigger-create for RI)
<li> Postgres support: <strong>Done</strong>
<li> Oracle support: <strong>Done</strong>
<li> DB/2 support: <strong>Done</strong>
<li> MS-SQL support: <strong>Done (needs to be tested)</strong>
<li> MySQL support: <strong>Done (Please test MyISAM vs. InnoDB)</strong>
<li> Informix support: Not started
<li> Ingres support: <strong>75% Done</strong>
<li> SAS support: <strong>Done</strong>
</ul>
<p>
Note that it should be <strong>easy</strong> to add Informix
and finish MS-SQL, MySQL, and Sybase support. All I
ask is you run the resultant script against the actual database
to make sure it doesn't complain about the SQL DDL output.
<h2>Short Feature List:</h2>
<ul>
<li> Generates tables and views using UML Classes
<li> Generates foreign key constraints using UML Associations
<li> Generates indexes and permissions using UML Class Operations
<li> Generates insert statements using UML Components
<li> Generates special SQL (like triggers and sequences) before or
after Schema (tables) creation
<li> NULL, NOT NULL, DEFAULT column handling using UML Class Attribute Values
<li> Generated SQL DDL well-formatted and easy-to-read
<li> Script is GPL Perl, written in a programmer-friendly style
<li> Uses XML::DOM to parse the Dia XML diagram
</ul>
<h2>My Own Testimonial</h2>
I've tested this script on a ~30-table schema with ~35
associations (foreign-key constraints), several inserts, and
~12 indexes, and it basically does the Right Thing, creating
valid Postgres, Oracle, DB2, and Sybase code. If you want, you
can get a
<a href="sampleImages/BigERD.png">screenshot</a>
of the big ERD as it's edited in Dia. I've purposefully made
the tables/columns very small in this screenshot to make the
screenshot small in bytesize. (Note: Sorry, I can't give you a
copy of this ERD for testing. Also, if you have a fairly large
ERD you've created in Dia that tedia2sql parses and that you
wouldn't mind the world having a copy of, please send me a
copy!)
<h2>Download the Script/Source:</h2>
Choose the Filesharing link to the left to download the source code.
There you will find versions of tedia2sql for download.
<h2>tedia2sql Documentation & Tarball-Included Files</h2>
<dl>
<dt> <a href="briefhelp.html">Brief Help</a> </dt>
<dd> The output of <i>tedia2sql -h</i> and detailed descriptions of each line.</dd>
<dt> <a href="usingtedia2sql.html">Using tedia2sql</a> </dt>
<dd> A little more in-depth information about how to
create a UML diagram in Dia that will properly parse
via tedia2sql into SQL DDL for your RDBMS.</dd>
<dt> <a href="todo.html">To-do</a></dt> </dt>
<dd> The tedia2sql to-do list. </dd>
<dt> <a href="AUTHORS.html">Authors</a></dt> </dt>
<dd> The tedia2sql authors and contact info page. </dd>
<dt> <a href="troubleshooting.html">Troubleshooting Guide</a></dt> </dt>
<dd> I made my diagram. I ran tedia2sql on it, and everything
went dramatically wrong! Help! </dd>
<dt> <a href="sampleImages/TestERD.png">TestERD.dia Screenshot</a> </dt>
<dd> This is an ERD for a simple image-rating system that
I created for generating SQL DDL. Tentatively, the
destination RDBMSs for this diagram would be Sybase, PostgreSQL,
and Oracle. Once MySQL supports views, then it should be added as
a target.</dd>
<dt> <a href="pgsql-testerd.sql">Postgres SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o pgsql-testerd -t postgres -d</i>
</dd>
<dt> <a href="sybase-testerd.sql">Sybase SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o sybase-testerd -t sybase -d</i>
</dd>
<dt> <a href="oracle-testerd.sql">Oracle SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o oracle-testerd -t oracle -d</i>
</dd>
<dt> <a href="ingres-testerd.sql">Ingres SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o ingres-testerd -t ingres -d</i>
</dd>
<dt> <a href="db2-testerd.sql">DB/2 SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o db2-testerd -t db2 -d</i>
</dd>
<dt> <a href="innodb-testerd.sql">MySQL InnoDB SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o innodb-testerd -t innodb -d</i>
</dd>
<dt> <a href="innodb-testerd.sql">MySQL InnoDB SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o innodb-testerd -t innodb -d</i>
</dd>
<dt> <a href="mysql-testerd.sql">MySQL MyISAM SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o mysql-testerd -t mysql -d</i>
</dd>
<dt> <a href="sas-testerd.sql">SAS SQL DDL</a> </dt>
<dd> If you run the script with <i>-i TestERD.dia -o sas-testerd -t sas -d</i>
</dd>
</dl>
<h2>Useful Links</h2>
<dl>
<dt><a href="http://www.lysator.liu.se/~alla/dia">The Dia Homepage</a></dt>
<dd>This is the place you go to find out all about Dia</dd>
<dt><a href="http://www.schemamania.org">Schemamania</a></dt>
<dd>This is a page dedicated to dealing with schemas.
It includes Dia-->SQL generation, but also
Dia-->C++ etc.</dd>
<dt><a href="http://postgresql.org">Postgres SQL Database Engine</a></dt>
<dd>Here you find a very high quality production-level
Open Source database engine. Commercial support is
available at <a href="http://www.pgsql.com">pgsql dot com</a>.</dd>
<dt><a href="http://cygwin.com">Cygwin (Unix Tools for Win32)</a></dt>
<dd>If you always wanted to run SSHd and Apache and
Bash, and you love the GNU text processing tools (and
vim and emacs and all that) and shell environment, and
you love to run a Free X server -- all this and you're
stuck on a Win32 machine, then I can't stress this
enough, <strong>DOWNLOAD AND INSTALL CYGWIN!</strong>
It is a thing of beauty running an rxvt with scrollback
buffer and Bash inside it, and typing
<i>ls -al /cygdrive/c/windows/system32</i> and getting
a beautiful GNU colourised file listing.
</dd>
<dt><a href="http://faemalia.org/do/pvwiki/show/OracleKnowledgeRepository">Oracle Knowledge Repository</a></dt>
<dd>A wiki dedicated to Oracle Knowledge. Since this is a wiki, it might
not just be Oracle tomorrow. It might branch out into who knows what.</dd>
</dl>
</body>
</html>
|