Ignore:
Timestamp:
18/01/12 11:46:07 (8 years ago)
Author:
mnagni
Message:

Now generate the inner class attributes and table relations which manage the attribute subtyping (at least for no more than the same subtyping attribute for each class)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/xmi2sqlalchemy/trunk/src/main/resources/velocity/python/sqlAlchemyTables.vm

    r8041 r8064  
    1111ARRAY(#substituteDBType(${attribute.associatedType.associatedClass.name}))#else 
    1212#substituteDBType(${attribute.associatedType.associatedClass.name})#end 
    13 #end 
    14  
    15 #macro( column $attribute) 
    16 Column('${attribute.name}', #attributeType(${attribute}) #checkNullable($attribute)), 
    1713#end 
    1814 
     
    4844#end 
    4945 
     46#macro( column $attribute) 
     47Column('${attribute.name}', #attributeType(${attribute}) #checkNullable($attribute)), 
     48#end 
    5049 
     50#macro( superColumn $tableModel) 
     51#foreach( $attribute in $tableModel.associatedClassModel.attributeModel) 
     52#if($attribute.subTypes) 
     53#foreach($sType in $attribute.subTypes) 
     54#set ($associatedCN = ${sType.associatedClass.name.toLowerCase()}) 
     55Column('_${associatedCN}_id', Integer, ForeignKey('${associatedCN}.id')), 
     56#end 
     57#end     
     58#end 
     59#end 
    5160 
    5261#macro( table $tableModel) 
     
    6069${tab}#column($attribute) 
    6170#end 
     71${tab}#superColumn($tableModel) 
    6272${tab}extend_existing=False,) 
    6373#end 
Note: See TracChangeset for help on using the changeset viewer.