Hi,
I am attempting to take a database on a SQL server instance on my machine and, from the command line, have TDM create a new model, reverse engineer the DB into the new model, and save out the model file.
I have been able to launch toad with a blank model but I have not yet found a way to execute the appropriate scripts to preform the Reverse engineering.
Any help is appriciated.
Thank you,
Dan
Hi,
you can find an example in the Help file. See attached screenshot.
Regadrs,
Vaclav
Thanks for pointing me in the right direction. I am having a little trouble with the example from the help file though. When I run the example, the script throws an error at the following line from the LoadPackagesByModelDefName, because MDef is null:
MDef.LoadPackages();
I’ve added some debugging statements and the GetObjectByName(AName) call is returning null when caled with AName = ‘Microsoft SQL Server 2008’
Am I using the wrong Model Definition name or do I have something else wron with my scripts?
Thanks again,
Dan
Hi,
I have several questions for you:
-
What version of Toad Data Modeler do you use?
-
What is the name of your stored alias (TDM 4.x) or connection (TDM 5) ?
(Please provide screenshot, if possible.)
- Did you install the software with all supported database platforms, please? (During installation you can choose database platforms. Ideally, install all items).
Thanks,
I have tried running this in Toad Data Modeler 4.3, as well as in version 5.0.5.31.
The Alias I created is called “DJE-alias1”. It connects to a DB on my local machine and is set to revese engineer the entire DB (Entities, Relationships, etc.)
I know that version 5.0.5 was installed with all the database platforms, and I believe that 4.3 was as well, though its been a while since I installed it.
The script that I am running from the scripting window in Toad 5.0.5 is attached. Please forgive the debuging message boxes.
Let me know if you need further detail of the Alias/Connection.
Thanks again,
Dan
ToadREScrpt.txt (3 KB)
Hi,
please use MS SQL Server 2008 instead of Microsoft SQL Server 2008. We used to use MS abbreviation in past and then changed the caption from MS to Microsoft.
Wrong:
var Model = RE(‘DJE-alias1’, App, ‘Microsoft SQL Server 2008’);
Correct:
var Model = RE(‘DJE-alias1’, App, ‘MS SQL Server 2008’);
To find out correct model def, do the following:
- Create new model for selected targret database.
- Enable Expert Mode in Settings.
- Click Expert Mode | Scripting Window
- Add your model to right side
- Run the following script
function main(){
Log.Information(Model.ModelDef.Name);
}
Result:
I hope it helps,
Vaclav,
I figured that it was something like that. After correcting that the script is working correctly.
Thank you very much for your help.
Dan