in

The ORM Foundation

Get the facts!

Controlling Generated Table Names Differently for Different Entities

Last post Mon, May 11 2009 20:05 by Matthew Curland. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • Sun, May 10 2009 14:01

    Controlling Generated Table Names Differently for Different Entities

    I'm working on enhancements to an existing datamart. Most of the existing tables are named "Dim*" for dimension tables, and "Fact*" for fact tables.

    Some of the facts I'm adding will wind up generating new tables, and I'd like these new tables to be named in the same pattern (once I'm sure that there will, indeed, be a new table added). I thought of adding custom properties to the generating entity types (IsDimensionTable and IsFactTable), but don't know where to go from there to influence the table names. Any pointers would be appreciated.

  • Sun, May 10 2009 16:54 In reply to

    Re: Controlling Generated Table Names Differently for Different Entities

    I have since read the tutorials (I had read them over a year ago - they've changed substantially!). I realized that I could use the abbreviation feature to produce reverse abbreviations. I can enter an abbreviation from "Time" to "DimTime", as an example.

     If there's a better way to do this en-masse, please let me know. For the present, I'm only working with a subset of the data mart, so the abbreviations technique is sufficient.

     Thanks, John

  • Mon, May 11 2009 6:53 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 805

    Re: Controlling Generated Table Names Differently for Different Entities

    Hi John,

    NORMA Tutorial 6 has the details of how to manage table and column names.

    From your post, it is not clear to me whether your "en masse" request relates to reverse engineering or to table generation from an object-role model.

    In general, we recommend that you control "en masse" changes by changing the object-role model and then regenerating the relational model from the new object-role model. I recently gave a simple example of this in the following thread: http://www.ormfoundation.org/forums/t/577.aspx  (click on the diagram in my post and the diagram will display more clearly)

    Ken  

  • Mon, May 11 2009 14:30 In reply to

    Re: Controlling Generated Table Names Differently for Different Entities

    Ken, thanks for the reply.

    To explain "en-masse", I'll provide a counter-example. I'm currently working with a model of a very small subset of our complete data mart. At present, this subset generates six tables. With only six tables, it was very easy to use the Abbreviations property to cause nORMa to generate the required names.

    The complete datamart consists of 18 tables before my modifications, which I believe will add another four tables. With that number, it would be easier to somehow indicate which of the 18 tables are "Fact" tables and which are "Dimension" tables, and to have the transformation system handle the naming for me as appropriate. One might use the new Groups feature, or a custom property, but it would be easier to place entities and other elements that generate tables into "Fact" or "Dimension" categories, then handle the naming for everything in a given category in the same way.

    As I said, I'm ok for the moment with my small model. The question that remains is for the future.

    That future being after I learn what I'm doing wrong when I attempt to import the entire current datamart. But that's a forum post for another day.

  • Mon, May 11 2009 20:05 In reply to

    Re: Controlling Generated Table Names Differently for Different Entities

    John,

    If you're willing to write some XSLT to mitigate this problem, then you can do a name modification after the tables are generated using an approach similar to the stopgap mechanism I put together for generating SQL Server schema names (http://www.ormfoundation.org/forums/p/573/1706.aspx#1706).

    Basically, you can create your own custom property to tell a 'File Format Modifier' to change the generated relational representation after NORMA is done with it. Look for uses of the schemaNamePropertyId variable in the XSLT for extracting the custom properties. The XSLT should be pretty straightforward: the table names are used for dcl:table definitions, and referenced by dcl:referenceConstraint (used as a foreign key).

    Let me know if you need other pointers.

    -Matt

     

Page 1 of 1 (5 items)
© 2008-2024 ------- Terms of Service