Book a Demo

Author Topic: DDL documentation, book  (Read 5780 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
DDL documentation, book
« on: September 25, 2015, 10:14:03 pm »
Hi,

I started working on integrating a new DBMS in EA.
I defined the Data Types and MDA Transformation Template. I copied the existing transformation DDL scripts and made a few changes although this is not straightforward...

I'm looking at the DDL scripts to generate the schema and I find it difficult understanding how it works.

I found some information in EA Help but not everything - for instance the following is not documented:
Code: [Select]
%DDLName("EA", "TABLE", "INCLUDE_OWNER")
CREATE TABLE %DDLName("EA", "TABLE", "INCLUDE_OWNER", "INCLUDE_SURROUND")

It would be nice to have a white paper from Sparx, or an ebook such as the very good Scripting EA, Inside EA, and Shapescripts (qwerty this is a question for you).

Thanks,
Guillaume
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DDL documentation, book
« Reply #1 on: September 25, 2015, 10:58:25 pm »
Phew. I once used that proprietary scripting from Sparx but found it too limiting. Once I discovered that I could do much more fancy things much more easily with a Perl (my bread and butter language) script I stopped using it. I'm not that kind of guy to promote things just to make money without being convinced of it.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: DDL documentation, book
« Reply #2 on: September 28, 2015, 11:06:07 pm »
Hi,

Thanks for your feedback. It would be useful to know if the help content can be improved to cover more aspects of this EA feature (question for Sparx admins).

My last question is to do with the DDL transformation: you can generate a DDL for your default DBMS from a UML class diagram however it doesn't seem to exist the other round, perhaps due to feasibility issues. Am I right?
Let's say you run a reverse engineering on a MySQL DB schema which you want to move up to a Business Class model. A Transformation of your tables and columns to UML classes and attributes could be useful..
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: DDL documentation, book
« Reply #3 on: September 29, 2015, 01:15:41 am »
The reverse engineering of concrete tables to abstract classes is something only a human can do (today). Abstraction is one privilege left for humans which all egg-heads so far could not formalize ;)

q.
« Last Edit: September 29, 2015, 01:16:03 am by qwerty »

MMA

  • EA User
  • **
  • Posts: 63
  • Karma: +3/-0
    • View Profile
Re: DDL documentation, book
« Reply #4 on: September 30, 2015, 01:53:15 pm »
Hi Guillaume,

1. the DDLName is a template macro, which means you can find the template "DDL Name" definition in the tree of DDL Template Editor.

For example,

CREATE TABLE %DDLName("EA", "TABLE", "INCLUDE_OWNER", "INCLUDE_SURROUND")%

click "DDL Name" in the tree, you can find that there are variables like "$parameter1", "$parameter2", "$parameter3" "$parameter4".

It is straight forward to see what logic these parameters served.

For example, suppose there is no "$parameter2" defined for "DDL Name" template, we will need lots and lots of field macros like DDLTableName, DDLProcedureName, DDLFunctionName, DDLViewName......; and it is impossible to add new types if EA does not support it.

However, in this way, it is a freedom to pass new arguments, even the number of parameter/arguments.

2. EA does support reverse engineering for Database ---- through ODBC.

Context menu on a package | Code Engineering | Import DB Schema from ODBC. Then EA will pull the schema from the connected DBMS and create tables/procedures/views/....

EA is actually doing more than this. From Tools | Database Builder | you can compare the model in EA and the current schema in your DBMS.

Then different will be picked up (E.g. field length is 10 inside EA and 20 in DBMS), then you can choose "merge to EA" or "merge to DBMS", suppose you choose merge to DBMS, a group of DDL scripts will be generated in an executable order.

3. As qwerty mentioned, the reverse engineering from "DDL text" is not trivial. Basically, a parser (for each different DBMSs and each DBMS has different versions which might have different grammar syntax) is needed to analyze the text. (Think how EA import C++/Java source code.)

Hope that helps
 ;)
« Last Edit: September 30, 2015, 01:57:07 pm by milesma »