A database maintanance and migration tool for SQL Server

What is dbweaver?

dbweaver is a set of Python scripts that allows to extract the definition of database objects, like tables, views, stored procedures and user defined functions from a Microsoft SQL Server and dump them in DDL format to ASCII files.

Furthermore it allows to write a XML file in dia format, that can be used for the visualization of the tables in UML.

Anyway, even if I'm using these scripts since half a year, a lot of things have to finished. If you would like to accelerate the development, don't hesitate tom contact me through the mailing lists or forums.

What works?

dbweaver is able to connect to a Microsoft SQL Server, to get most of the objects and write them to a file. The files are simple text files and can be processed by CVS or whatever else.

The export to Dia has still to be improved, since only the most basic informations of the tables are written. In the future atributes as constraints and views should be visualized through Dia, too. Furthermore, I would like to write some Dia macros, so that the diagram and the databse coule be synchronised. Luckily, Dia is Python scripable.

Obviously, the DDL files can be used to migrate a database structure from SQL Server to another database server. Anyway, these files must still be hand edited inorder to adapt SQL-Server data types to standard data types (e.g. datetime -> timestamp). This translation should one day be done by dbweaver.

What's needed?

You need a reasonably recent version of Python, possibly 2.2.

If you are working on Windows, you will need Mark Hammond's Python Windows Extensions, in case that you have the standard Windows Python distribution, or nothing special when using ActiveStates ActivePython (the one that I'm using when using Windows).

Unfortunatly, the current version of dbweaver does not work with ODBC out of the box, since the Python ODBC module lacks support for the cursor.rowcount attribute.

In case you're running a non MS-OS, you will need FreeTDS for basic SQL Server connectivity and David Cole's Python Sybase Connector (or use unixODBC).


The next things will be support for Foreign Keys and improve the export to PostgreSQL. I will try to bundle the existing code into a distribution file before that. A more datailed list of what I would like to put into this is in the TODO file.


dbweaver can be downloaded from the Sourceforge.net download sites.

The most recent version s obtainable through CVS.

SourceForge.net Logo