Toad World® Forums

Exporting YAML


#1

Is there a convenient way to export a logical (or physical) model to a yaml file?
It could be very useful, since some developing tools (like Symfony for PHP) expect schemas defined in yaml (even if other alternatives are available).
At the moment, as far as I know, the only way to produce yaml schemas with tdm is:

  • design a logical model and convert to a physical model or design a physical model
  • generate the script
  • execute the script
  • let some back-engineering tool analize the database and produce the yaml file.

Just curious.


#2

Hi,

thanks for your feedback. TDM allows you to export meta data to XML, CSV, TXT, XSD… and other formats via XSL Transformations. I looked at YAML and Propel and wrote two simple (don’t expect fully functional output) templates that converts meta data from MySQL models to XML-propel or YAML format.

Both XSL templates can be used for inspiration and further developement. The current outputs will only contain data related to tables and columns, nothing else. You (or I, but later) can add instructions for processing PK, FK, unique attributes, indexes… etc.

What I see as an advantage in comparison with “back-generated” yaml files is, that you can define logical information in TDM (Captions) and then use the data for phpName values. I used them in the sample XSL templates.

How does it work?

Download the files, extract them from zip archives, then copy the files to:

C:\program files\quest software\toad data modeler 3\xsl

Open your MySQL model and click Model | Reports / XSL transformations. New dialog opens. Select one of the two new items and generate either XML or Yaml file by clicking on the Transform button.

I hope it helps :slight_smile:

Regards,

Vaclav
propel-xml.zip (1.42 KB)


#3

Hi,

thanks for your feedback. TDM allows you to export meta data to XML, CSV, TXT, XSD… and other formats via XSL Transformations. I looked at YAML and Propel and wrote two simple (don’t expect fully functional output) templates that converts meta data from MySQL models to XML-propel or YAML format.

Both XSL templates can be used for inspiration and further developement. The current outputs will only contain data related to tables and columns, nothing else. You (or I, but later) can add instructions for processing PK, FK, unique attributes, indexes… etc.

What I see as an advantage in comparison with “back-generated” yaml files is, that you can define logical information in TDM (Captions) and then use the data for phpName values. I used them in the sample XSL templates.

How does it work?

Download the files, extract them from zip archives, then copy the files to:

C:\program files\quest software\toad data modeler 3\xsl

Open your MySQL model and click Model | Reports / XSL transformations. New dialog opens. Select one of the two new items and generate either XML or Yaml file by clicking on the Transform button.

I hope it helps :slight_smile:

Regards,

Vaclav
yaml.zip (1.38 KB)


#4

Wow!
Once again I must admin: Toad gives THE customer care.
Thank you!


#5

Thank you! I’ll improve the templates, hopefully next week. There seems to be relatively easy way how to help propel/yaml users to get what they want. TDM is powerful, more than it seems to be…

Have a great day,

Vaclav


#6

Yes.
The so short delay between my question and the plugins you published was astonishing.

Hoping to be helpful, I’ll give you my feedback: the yaml file you are producing is tab indented.

Pay attention: yaml prohibits tabs and forces you to use spaces instead. You should indent using 2 spaces instead of a tab


#7

:slight_smile: thank you. And thanks for the info about tabs. I went throught yaml spec quickly, that’s why I certainly missed some valuable information.

Regards,

Vaclav