Toad World® Forums

Generating a special type of "DDL"

Hello,

we would like to generate Liquibase XML definitions out of a TOAD model.

I’m unsure whether a XSLT that transforms a model or a script/macro is the better idea. After looking at the TOAD XML files it seems that it will be very hard to access the actual (physical) data types from the model from within XSLT.

So it seems that using a TOAD script (package) is the better solution.

In order to be able to do that, the script needs full access to the entities, attributes relationships and constraints defined in the model.

From what I can see this is the case, but I would like to have a confirmation before I go down that road.

We would also like to generate a Liquibase change set from a TOAD model comparison.

Is it possible to start a model comparison (e.g. between two files or even better between two versions from SVN) and access the result of that comparison from within a script?

Hi,

liquidbase seems to be a nice helper. We will certainly look into the matter.

RE access to comparison result: please give us one day. I will be able to provide more information tomorrow.

In general, if you wish to get some XML output, you have two possibilities. Either use XSLT transformation in TDM (simplified XML format is used) or write scripts that will iterate objects and store output to defined file format.

XSLT reports and transformations:
http://modeling.inside.quest.com/entry.jspa?externalID=3023&categoryID=158
Note: simplified XML will be generated if you select Complete XML item on XSL tranformation dialog.

Scripting:
Advantage can be in possibility to easily work with custom properties etc.
In documentation you can find some samples or see our blog, section Customization for some examples.

Regards,

Vaclav

Hi,

download the UniversalXMLReport.zip package from:
http://modeling.inside.quest.com/entry!default.jspa?categoryID=34&externalID=4893
and import it to Toad Data Modeler.

How to import packages:
http://blogs.inside.quest.com/modeling/2010/10/21/how-to-import-custom-packages/

Regards,

Vaclav & Petr

Thanks for the answer.

Will take me a while to understand what these things are doing.

Is there a complete documentation for the XML format available?

I have also a hard time understanding the sampel Macros.

I found one that is named “GenerateCsvLogicalModel” but I cannot figure out how I can access the data type of an attribute. Attribute.DataType always returns “undefined”.

Is there a docoumentation (apart from the “Reference” in the online help) that documents how to access the objects in the different model types?

I managed to get the XSLT working to convert a physical model (based on the simplified XML) to a Liquibase XML.

I’ll mark this questions answered (although I still need to figure out how to process the result of a model compare)

I moved from the XSTL approach to a macro approach, because that also lets me generate the changeset for selected objects in the workspace.

Now having this in place, I would like to ask the question again:

Is it possible to start a model comparison (e.g. between two files or even better between two versions from SVN) and access the result of that comparison from within a script?

As far as I can tell, model comparison is a “report” package. Is that correct?
Or is there a

I could not find any example in the library that contains a customized script for reporting (or model comparison)

The ideal solution would be if the “Sync & Convert” wizard - when using “Generate Alter Report” - would have a new output format “Liquibase”.

But if I can start the compare from within a script “manually” (creating some kind of dialog to select output file etc) that would be just as good.

Hi,

re the question: "everything is possible" but that might be too difficult.
The package that improves HTML report generates XML file. Open Package Explorer and navigate to custom package UniversalXMLReport. There is script UniversalHTMLAlterReport_2, right click the script and choose Edit Source Code. See code that fills XMLStringList with XML nodes.

There also is a path to the XML fle. I recommend you to create subfolder in JScript and put the file to subfolder, if you do not want the generated XML file to be mixed with other HTML files. Or you can set there some hard-coded absolute path.

Generation of custom output from Sync & Convert wizard would be complicated. If you don't mind, I feel that generation of new output in addition to standard report is the fastest and the less complicated solution.

Regards,

Vaclav

Message was edited by: vaclav

Hi,

re the question: "everything is possible" but that might be too difficult.
The package that improves HTML report generates XML file. Open Package Explorer and navigate to custom package UniversalXMLReport. There is script UniversalHTMLAlterReport_2, right click the script and choose Edit Source Code. See code that fills XMLStringList with XML nodes.

There also is a path to the XML fle. I recommend you to create subfolder in JScript and put the file to subfolder, if you do not want the generated XML file to be mixed with other HTML files. Or you can set there some hard-coded absolute path.

Generation of custom output from Sync & Convert wizard would be complicated. If you don't mind, I feel that generation of new output in addition to standard report is the fastest and the less complicated solution.

Regards,

Vaclav

Message was edited by: vaclav

vaclav wrote:

The package that improves HTML report generates XML file. Open Package Explorer and navigate to custom package UniversalXMLReport. There is script UniversalHTMLAlterReport_2, right click the script and choose Edit Source Code. See code that fills XMLStringList with XML nodes.

If I understand you correctly, I should change the way UniversalHTMLAlterReport_2 is working and and write the Liquibase XML directly from within that script.

I guess the best way would be to create a new package and put a copy of that script into the new package (so that I don’t break anything in the existing package).

But I’m not sure how I would create that package so that it actually shows up as a new report type in the sync & convert wizard.

Do I need to select anything for “Package Dependency” or “Package Extension”? As far as I can tell, this is not necessary. But I don’t see how I would create the “External Class Definitions” that seem to be necessary. Are they created automatically when I create the script for the report?