Customized DB Templates

A friend at an organization I used to work for needed to change the schema generation for DB2 databases in EA.  The requirement they needed to fulfill was to have the construction of various DDL attributes be based on some meta-data properties.

The idea was to have the meta-data properties stored as tagged values and then amend the existing templates to use these tagged values.

My friend had a little bit of trouble accessing the tagged values in the templates and wondered what was going on.

I had been looking at Model Transformation and Code Generation templates and had reasoned that all these, together with the DDL Generation templates, all used the same templating engine within EA.

My first bit of advice was, to go look at the template substitutuon macros in the code generation templates and to try the relevant ones to get the tagged values out.

On experimenting with these we found that they didn't work with the DDL generation.

Having another look through the documentation we came across this page giving the class attributes for templates involved in DDL generation. If you're having a quick look you might miss it, but about half way down the page, the documentation starts listing attributes to use for custom properties (for "USER DEFINED PROPERTIES", including tagged values (in our case it was tableUserProperty). And once we used this, it worked as expected.

I'm not sure why EA for DDL generation would differentiate between standard and custom properties but I'd be surprised if there wasn't a good reason under the bonnet.

The EA documentation is excellent given the complexity and extensible nature of the product. The lesson that I've taken from this event is that:
  1. Don't jump to conclusions
  2. The detail that you need is probably in the EA doco but it might not be easy to find
  3. You can't underestimate the value of just-trying-things-out

[Originally posted here.]

Comments

Popular posts from this blog

Creating Items in Sparx EA via Java

Module Management - Part 1 - getModule() Pattern

Traversing a EA Model via Java