Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automating reverse engineer database model with Visio

We develop and maintain our database schema with a custom tool. SQL scripts and runtime files are generated from that tool. However, it does not provide a very good visual representation.

Lately I been using Visio to reverse engineer the schema. This is working great so far. But to be able to do this, I need to:

  1. create an empty database
  2. execute the generated script
  3. start up visio
  4. choose reverse engineering and choose the created database
  5. select all tables, etc
  6. wait for generation

I really want to automate this process. Step 1 and 2 are easy, but how can I automate the other steps.

I've been looking for a C# library to create Visio diagrams, but they al seem not suitable for this task.

For instance http://visioautomation.codeplex.com/ and http://www.graphviz.org/ look promising, but on a closer look they were not appropriate.

I've tried to record macro, but the macro recorder does not work in conjuction with the reverse engineering tools.

like image 563
Michiel Overeem Avatar asked Dec 11 '09 18:12

Michiel Overeem


People also ask

Can Visio reverse engineer database?

In your database model diagram, on the Database tab, click Reverse Engineer. On the first screen of the Reverse Engineer Wizard, do the following: Select the Microsoft Visio database driver for your database management system (DBMS).

Can Visio connect to a database?

Connect SQL Server Data to DiagramsOn the Data tab, click Link Data to Shapes. Select the ODBC option and select ODBC DSN. Select the DSN for SQL Server, select the table you want to import, and finish the wizard. This article uses Orders as an example.

Can you use Visio for data modeling?

Some tools like Power BI can map out the relationships between data tables using automated intelligence. Instead of building the model from scratch, you can go in and make some adjustments here and there. Using Visio allows modeling the data for other tools as well.


1 Answers

Michiel,

I am using Visio 2007 and SQLite 3.

Tonight I had a crack at reverse engineering my Sqlite3 database with success. The key is to download an ODBC driver for Sqlite. I found some here > http://www.ch-werner.de/sqliteodbc/. I installed the current one at the top of the list "sqliteodbc.exe".

Then the MSVisio set up was a bit muddled so forgive me if I do not explain the details in an exact, repeatable format.

  1. The new installed ODBC driver should appear in Visio when you select: Database > Reverse Engineer > Setup.
  2. Scroll down and check one of the three Sqlite drivers - I chose the "SQLite3 ODBC Driver"
  3. Then click on "New" > Check "System Data Source" > Scroll down select "SQLite3 ODBC Driver" > Click "Finish"
  4. On the dialog that it entitled "ODBC DNS Configuration" is where you enter your Sqlite database settings. The "Database Name" is simply the path and file name of your database. The "Data Source Name" can be anything meaningful to you as it will appear in the Visio dropdown whenever you want to reverse engineer. There are some other settings you can experiment with as well.
  5. When you commence reverse engineering you will be asked to connect to your datasource using your credentials. At this point you will get a warning ...

Warning! You are using a Visio 'ODBC Generic Driver' to connect with a 'SQLite' DBMS datasource. By using an incompatible driver, it is possible that the catalog information retrieved will be incomplete.

Just click 'OK' and ignore this.

Unfortunately, in the next screen the option to select "Views" and "Triggers" are greyed out (you can select Tables: Primary Keys, Indexes, Foreign Keys though). This is a shame as I have defined a lot of these in my schema and I have benefited from rev-enging these in Oracle many times in the past.

That is it. Hope someone can find a fix for rev-enging the views.

Dan

like image 188
Dan Fernandez Avatar answered Sep 22 '22 13:09

Dan Fernandez