Create Copy of Model While Removing Certain Entities/Attributes

I’m working on a long term project with multiple phases and would like to have a single model to handle our database design and DDL generation for all phases. I’d like to be able to have entities/attributes in the model that we don’t expect until later phases but still generate DDL for just phase 1. So for example I’d like to have say 50 entities in my model and mark 10 of them as “Phase 1.” Similarly, even within those 10 entities for phase 1, I’d like to be able to add attributes that aren’t expected until later phases (and somehow mark them as “Phase 1” too), so you might have 8 attributes that are for phase 1 and 3 that are for other phases. When generating DDL, I’d like to be able to generate just the 10 entities and 8 attributes.

I thought about using the “generate” checkbox but that only seems to apply to entities and not attributes. Then I created a custom property on PEREntityMS08 and PERAttributeMS08 called “TargetPhase” thinking I could generage DDL based on that. If I couldn’t generate DDL based on that property I figured I could create a new model called “MyModel_Phase1” and just copy over the entities/attributes marked with “Phase 1” from the main model via a script into the second model and then just use the second model to generate my DDL. Alternatively I could just copy the original model’s file to a whole new file, open that and then have a script delete any attributes/entities that aren’t marked as phase 1. I actually tried that last approach and got all kinds of “access denied” messages so before spending more time on it I wondered if there is a “built in” or better way to approach this.

Hello,

Sorry for the delay. We didn’t miss your question, we’ve only been pondering on the solution for you.

We suggest you to do model conversion:

  1. Open the Sync&Convert Wizard.
  2. Select Action - Convert Model…
  3. Select Left Side - It is your currently active model (e.g. MS SQL 2008).
  4. Select Right Side - Select the same db platform (MS SQL 2008).
  5. Select Object Types - Feel free to disable objects that you don’t want to convert to the new model.
  6. Select Items - Go through all entities and attributes and for those that you don’t want to have in the new model, clear the Action box.
  7. Finish the conversion.

Result: You will get a new model that will contain only the entities and attributes for which you want to generate SQL script.

Well, we hope this solution will help you a little.

Flash movie on model conversion:
http://modeling.inside.quest.com/entry.jspa?externalID=3027&categoryID=158

Let me write about other few functions/options that you might appreciate to know about.

  1. Generally, to create projects, keep track of versions, work with particular version(s) (compare them, generate script or report etc.) you can use Version Manager.
    Flash movie on VM:
    http://modeling.inside.quest.com/entry.jspa?externalID=1697&categoryID=281

  2. To select entities and set the Generate checkbox only for the selected entities very quickly, you can use the Set Generate macro. The macro is available at:
    http://modeling.inside.quest.com/entry.jspa?externalID=3611&categoryID=34
    See the attached PDF doc there - with instructions on how to use the macro.
    The macro will be available in the main menu Macros and also in pop-up menu of objects.
    You can select the entities in Model Explorer or Object Viewer | right-click | Macros | Set Generate on Selected Objects Only.

As attributes do not have the Generate box, it is not possible to use this macro for them.

Note: Flash movie on Object Viewer:
http://modeling.inside.quest.com/entry.jspa?externalID=3963&categoryID=158

  1. Flash movie on copy and move techniques of entities and attributes:
    http://modeling.inside.quest.com/entry.jspa?externalID=1676&categoryID=158

If you have any questions, please write us back. Thanks.

Regards,

Vladka + TDM Team

Hi Vladka and Team. Thank you very much for your detailed response. I’m sorry for my slow response too - I got assigned to work on something else for most of last week so I’m just back to this now. I tried out the model conversion approach and it worked but there is one pretty big issue. I want to be able to create the new model many times and not have to go through all those steps every time (I’m sure I’ll miss something sometimes and it would be very time intensive to go uncheck everything I don’t want generated). I didn’t see any way to store my choices so I could re-do the same conversion over again. Is there a way to do that? For a one time conversion this would be great but I want to maintain the one model and then at any time, create the new “Phase 1” model and generate a DDL or change script. Version manager seemed to be a good approach for version control tracking change over time. But again, I want to be able to maintain one version and at any time automate generation of a second model with only certain entities/attributes. It seems like a different requirement - with version manager, once I branch off to a different version, changes made to the original version won’t affect it right? My ideal workflow would be: 1. Create and maintain a single model.

  1. Mark any entity/attribute/etc. with a custom property that says “Phase 1” or “Phase N.”
  2. Generate a new model from the original model that only contains objects marked “Phase N.” Step 3 should be as quick and easy as possible. Ideally, a few clicks but definitely using previously stored data about which object goes in which phase so no one has to remember which are in what phase each time. I think I have custom properties working where I can assign “Phase N” to an entity/attribute. Is there a way to just enumerate all objects in a model and push them into a new model if the “Phase” property is a certain value? Or create a physical copy of the model’s file on disk and then script deletion of everything but “Phase N” objects? Any other ideas would be greatly appreciated. Thanks!

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the “Generate” option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc…). It is also possible define default value for custom properties…

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value… and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin
tdm35_049.png

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the “Generate” option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc…). It is also possible define default value for custom properties…

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value… and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin
ObjectPhase.zip (5.53 KB)

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the "Generate" option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc....). It is also possible define default value for custom properties...

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value.... and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the "Generate" option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc....). It is also possible define default value for custom properties...

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value.... and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the "Generate" option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc....). It is also possible define default value for custom properties...

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value.... and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin

Hi,

I made a package for you. It contains the following features:

  • New combo box available on Entity and Attribute forms
  • In the combo box there are five Phases predefined
  • Selected value will be stored with model

You can select entities on workspace, entities in Model explorer and attributes in Model explorer, right click any of the selected item and:

  • Set Phase to all selected object to defined value at once
  • Enable the "Generate" option to all selected objects (entities only)
  • Delete all entities and attributes except objects in defined phase
  • Write current Phase information to Message Explorer

Additional standard features:

  • All the features will be accessible for objects in Object Viewer (search for attributes, define Phase for all items in result set etc....). It is also possible define default value for custom properties...

This will allow you to work with the Phase values comfortably - you can easily set the default value to Phase 1 (will be used for all new objects). Later you can - for example - select several objects and change the phase to Phase 2. Then you can check your Phase information (write to Message Explorer) and when everything is OK, you can delete all entities and attributes except those with Phase 2 value.... and save it as new model -> generate SQL for it. :slight_smile: I need to put toghether documentation - will be published tomorrow as a blog post.

Have a nice day,

Vaclav Message was edited by: vladka

Message was edited by: modelingadmin

Hi,

Here’s the link to the article on the blog:
http://blogs.inside.quest.com/modeling/2010/05/27/customization-example-object-phase-package/

Regards,

Vl.

WOW! This is awesome! Thank you so much for taking the time to do this. The blog is great too - the fact that you were able to meet this random requirement so well really is a testament to the flexibility of the Toad DM extensibility features.

I was able to try out a lot of the features and everything seems to work fine for me except with the “delete all objects except objects in defined phase” part. I got an “Access violation” but then remembered about the note in the blog to close the model explorer first. Once I did that it worked fine.

I can think of one feature that would be great, which is to have the “delete all except” part delete all except objects in the phase you select OR any earlier phases. Maybe I can figure out how to do that by looking at what you’ve done… but it is easy enough to just move everything in phase 1 to phase 2 once you get to the point of needing to generate phase 2 DDL.

Again, thank you so much for this. It is really nice work and I really appreciate it!

Hi,

Thanks for your feedback.

Vladka + TDM Team

Hello,

Please find attached updated package. Please replace the existing one with this new one.
Note: The deletion has been improved. However, still it is necessary to close Model Explorer before the deletion. This issue will be resolved in next Beta 3.6.2.

Thanks.

Regards,

Vladka
ObjectPhase3.zip (5.61 KB)