Skip to Content
0

PowerDesigner 16.5 UpdateModelFromDatabase function in VBscript

Jul 24, 2017 at 05:38 PM

105

avatar image
Former Member

Hi,

I am trying to write a script that compares two physical data models. I already have a PDM on my repository and I want to compare it to a reverse-engineered PDM which is the DB production version of the same model. The idea is to update the repository version when the production version changes. I was wondering if there was a function in VBScript that was doing the same thing (or almost) as the "UpdateModelFromDatabase" option on the PowerDesigner GUI. I also noticed the "Compare" function in VBScript, which could potentially help me. Unfortunately, there is not a lot of documentation around and it is hard to know how to include the differents parameters to correctly use that function.

I am seeking the attention of someone who ever tried to code something like I'm describing. Thanks a lot in advance for your precious help.

Antoine

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
George McGeachie Jul 25, 2017 at 03:13 PM
0

Sorry, I'm with you now.

On the Database menu, you'll find the option "Update Model from Database", which will connect to the database and update the model with selected changes. Use this in combination with model versions in the repository (along with perhaps Branches and/or configurations). Alternatively, carry on reverse-engineering into new models, then merge those models into your master PDM.

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks a lot for you help! I'll be trying this. I just noticed that I have your book on my desk! I have to say that it helped me a lot to go through all the possible options in PowerDesigner. Do you know if there is a "Update Model from Database""-like function in VBScript? In the best world, I would like to automate the update process without having to go through the PD GUI to update my models manually each time.

Regards,

Antoine

0
George McGeachie Jul 24, 2017 at 08:31 PM
0

Tp update the repository version of a model, just check it in :). Use the CheckIn Method on the cls_BaseModel class.

Share
10 |10000 characters needed characters left characters exceeded
Phillip Lam
Jul 24, 2017 at 06:20 PM
0

YES.

For model object, there is a function called UpdateFromRepository.

In your Powerdesigner, go to Help->Metamodel Objects Help. In Index tab, Search for BaseModel.

Study the fuction's signature.

This is the code sample: ( Use default parameters in UpdateFromRepository)

set model=ActiveModel

model.updateFromRepository()

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jul 25, 2017 at 02:42 PM
0

George, I already tried the CheckIn function, but it doesn't seem to be working in my case. I think that maybe I did not explained myself very well, so I am going to try it one more time. Let's say, in the beginning, that I don't have any model at all in my PD workspace. The first model that I create, let's call it MODEL1, is created by doing the reverse-engineering of a database. From there, I check-in MODEL1 in my repository. Now, couple days later, the development team has been working on the DB and the structure has slightly changed (new tables, new columns, etc.) and I want to reflet these changes on MODEL1, that isn't up-to-date. So:

1 - I have a first version of MODEL1 in my repository ;

2 - The only way to reflect the changes on the DB to a PDM is to perform another reverse-engineer ;

3 - Now that I have performed a new reverse-engineer on my DB, I have a new PDM (let's call it MODEL2) that is the up-to-date version of MODEL1 ;

4 - BUT, because MODEL2 is not the ''child'' nor ''family linked'' with MODEL1 and MODEL1 has not been checked-out of the repository, it is not possible to perform a simple CheckIn function to update MODEL1 to MODEL2. It's like if a new model is created each time that a reverse-engineer function is done...and each model is independant to one another even if they come from the same DB.

This is why I wanted to know if a certain function ''UpdateModelFromDatabase" existed...or a function that could help me do what I am trying to do. It would be much simpler if the CheckIn function could work!

Thanks anyways, I appreciate the help very much!

Antoine

Share
10 |10000 characters needed characters left characters exceeded