in

The ORM Foundation

Get the facts!

Reverse engineering - from MySQL database to ORM 2 model?

Last post Thu, Jan 28 2016 13:50 by Ken Evans. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • Tue, Jan 26 2016 14:34

    • marcbeckers
    • Top 75 Contributor
      Male
    • Joined on Fri, Jan 8 2016
    • The Netherlands
    • Posts 9

    Reverse engineering - from MySQL database to ORM 2 model?

    Hi,

     

    I was wondering if it is possible to reverse engineer an existing MySQL database to an ORM 2 model? Is this possible? If yes, is there a document/ tutorial about it?

     

    Kind regards,

     

    Marc Beckers

    Filed under:
  • Wed, Jan 27 2016 22:04 In reply to

    • mnnoon
    • Top 10 Contributor
      Male
    • Joined on Wed, Apr 16 2008
    • Lawndale, CA
    • Posts 60

    Re: Reverse engineering - from MySQL database to ORM 2 model?

     Hi Marc,

    As far as reverse engineer I have tried this in Sql 2012 and it works well - I believe its called db import it memory serves and I believe that is what you are asking for hopefully.  However it will only convert tables and well formed table relationships over and will not even look at views, functions or stored procedures however there might be a few exceptions.  As far as MySQL it may work the same way if you have the right .net data provider setup and you use the Orm icon in the solution explorer that says DB Import.  Once the database has been imported into your system via a specific Schema prefix that you choose it should also add them to the current window it you select yes.  Otherwise it will go only into the object model.

    I think there are basically two stages: 

    1. 1st is Successful importing data model (tables and primary keys and foreign key relationships and maybe a single schema name)

    2. Secondly the converting back to MySQL or Sql Server from the Object model uses XSL style sheet under the covers so to speak.

    For the 1st step to be successful start with a smaller data set... I usually prune unnecessary tables from the database, or I place them in a separate schema when perform an orm import.  Not sure if you can place them in a separate schema in MySQL but you can copy to a new DB and then remove unneeded tables. 

     For the 2nd step to be successful you have to right click an empty area in the design surface and select relational view or ER model.  It will then activate the necessary parts of the orm modeler to allow you to save the file and select various other languages to convert to include MySQL and sql server, or sql standard.    Where the .orm extension is in the solution explorer it should allow you to right click that and check SQL Server or other options to convert to...  So there are basically two steps to this conversion process.   Other ideas for differentiating tables if you require schemas are to use table prefixes and then run a script to convert the tables to necessary schema by keying off the prefix.  The import only imports one schema period.

     Regards,

    Marc Noon

  • Thu, Jan 28 2016 13:50 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 805

    Re: Reverse engineering - from MySQL database to ORM 2 model?

    Hi Marc,

    "I was wondering if it is possible to reverse engineer an existing MySQL database to an ORM 2 model? Is this possible? If yes, is there a document/ tutorial about it?"

     Yes - you can reverse engineer MySQL into ORM2. There are two methods that come to mind:

    1: Directly into NORMA
    Start NORMA using the DB Import option in Visual Studio
    Then choose the ODBC data source and follow the dialog boxes.

    If that does not work then try method 2  

    2: Via SQL Server
    Import the MySQL database into SQL Server using Microsoft's SSMA tool:  http://blogs.msdn.com/b/ssma/

    Then start NORMA using the DB Import option in Visual Studio
    Choose the SQL Server option and follow the dialog boxes.

     ------------

    There is a tutorial for the DB import in the Library.

    Ken 

Page 1 of 1 (3 items)
© 2008-2024 ------- Terms of Service