Skip to main content

Creating Entity Relationship Diagram in Visio 2010

Creating Entity Relationship Diagram in Visio

It is a common task for a developer to build an Entity Relationship (ER) Diagram for an existing database.  If you are dealing with an MS SQL Server, this can be done easily within SQL Server Management Studio, but what if you are given a database in MS Access, PostgreSQL, or MySQL.  There are tools (such as ModelRight) to help you with this, but if you have got MS Visio Professional Edition, you have another option.
Since Visio 2003, a new feature, Reverse Engineer, has been made available in its Professional edition (and Premium edition in Visio 2010).  This feature allows you to connect to an existing database, extract database schema, and create an ER Diagram automatically.  You can also lay things out in the way that you want, and catch changes made to the database.
The key here is to create a connection to your database.  It does not have to be a Microsoft database.  Most likely, if there is an ODBC Data Source defined on your computer, you can connect to your database in Visio and generate the diagram.  In the rest of this article, I will show you how to generate an ER Diagram for an existing Access Database using Visio 2010 Professional Edition.  The process would be similar for connecting to other types of databases.
  1. Make sure you have an ODBC Data Source defined for MS Access Database.  Usually, you do not have to do this for Access Database.  It should have been created when Office or Visio is installed.  For other types of databases, you may need to first install an ODBC Driver which is often available from your database provider.
  2. Start Visio, and choose Database Model Diagram Template under Software and Database Template Category.  It is important to choose the right template, or you will not see the feature we want to use.ChooseTemplate
  3. Once the file is created, you will see two new things that you normally do not see.  The Tables and Views window in the Task Pane, and the Database Tab in the Ribbon area.  Please note that you will not see them, if you did not choose the right template in step #2.NewThings
  4. Click on the Reverse Engineer button under the Database Tab to start the Reverse Engineer Wizard.ReverseEngineerWizard
  5. Select Microsoft Access in the Installed Visio drivers drop down list, and choose MS Access Database as the data source. (If you are connecting to another type of database, you may have to choose ODBC Generic Driver in this step.)SelectDataSource
  6. Then you will be asked for user credential.  Leave them blank if the database is not password protected. (This step may look different, if you are connecting to another type of database, but the wizard should lead you through the data source setup in a similar way.)  Select your Access Database file and click OK to continue.PickFile
  7. You will be given the chance to select types of objects you want to pull from your database.  Do all that and then click Next to continue.ObjectOptionsTablesOtherOptions
  8. After everything is set, click Finish to close the wizard window.Confirmation
  9. Visio will then connect to your database, and pull desired information back.  Tables and Views will be placed in the Task Pane, and shapes and connections will be drawn on the current page (if you chose to do so in step #7).Diagram
  10. You can drag the entities around on the page without breaking the relationships, and click the Refresh button under the Database tab to get changes from the database.  During the update, new Tables or Views will be added to the Task Pane, changes may be applied to the diagram, and everything else should be kept unchanged.

Comments

  1. Thanks for the article. Any chance of updating the links to the figures, so the web diagrams show up?

    ReplyDelete

Post a Comment

Popular posts from this blog

ODI KM Adding Order by Option

You can add Order by statement to queries by editing KM.I have edited IKM SQL Control Append to provide Order by.  1) Add an option to KM named USE_ORDER_BY, its type is Checkbox and default value is False. This option determines you want an order by statement at your query. 2)Add second option to KM named ORDER_BY, type is Text. You will get order by values to your query by this option. 3) Editing Insert New Rows detail of KM. Adding below three line code after having clause. That's it! <% if (odiRef.getOption("USE_ORDER_ BY").equals("1")) { %> ORDER BY <%=odiRef.getOption("ORDER_BY" )%> <%} %>  If USE_ORDER_BY option is not used, empty value of ORDER_BY option get error. And executions of KM appears as such below; At this execution, I checked the KM to not get errors if ORDER_BY option value is null. There is no prove of ORDER BY I'm glad.  Second execution to get  Ord...

Creating Yellow Interface in ODI

Hello everyone! In Oracle data integrator (ODI), an  interface  is an object which populates one datastore, called the  target , with data coming from one or more other datastores, known as  sources . The fields of the source datastore are linked to those in the target datastore using the concept of  Mapping . Temporary interfaces used in ODI are popularly known as  Yellow Interfaces . It is because ODI generates a yellow icon at the time of creation of a yellow interface as opposed to the blue icon of a regular interface. The advantage of using a yellow interface is to avoid the creation of  Models each time you need to use it in an interface. Since they are temporary, they are not a part of the data model and hence don’t need to be in the Model. So let’s begin and start creating our yellow interface! Pre-requisites : Oracle 10g Express Edition with *SQL Plus, Oracle Data Integrator 11g. Open *SQL Plus and create a new table  Sales ...

Synchronous and Asynchronous execution in ODI

In data warehouse designing, an important step is to deciding which step is before/after. Newly added packages and required DW data must be analyzed carefully. Synchronous addings can lengthen ETL duration. Interfaces, procedures without generated scenario cannot be executed in parallel. Only scenario executions can be parallel in ODI. Default scenario execution is synch in ODI. If you want to set a scenario to executed in parallel then you will write “-SYNC_MODE=2″ on command tab or select Synchronous / Asynchronous option Asynchronous in General tab. I have created a package as interfaces executes as; INT_JOBS parallel  INT_REGIONS synch  INT_REGIONS synch  INT_COUNTRIES synch  INT_LOCATIONS parallel  INT_EMPLOYEES parallel (Interfaces are independent.) Selecting beginning and ending times and durations from repository tables as ODI 11g operator is not calculating these values. It is obvious in ODI 10g operator. SELECT    sess_no...