Ignore:
Timestamp:
23/12/11 15:20:16 (8 years ago)
Author:
mnagni
Message:

Works fine but I have to find a way to initialize the python classes attributes

File:
1 edited

Legend:

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

    r8040 r8041  
    1717#end 
    1818 
    19 #macro(checkUseAlter $fk, $fkName) 
     19#macro(checkUseAlter $fk, $fkName, $relName) 
    2020#if($fk.useAlter) 
    21 , use_alter=True, name='fk_${fkName}'#end 
     21, use_alter=True, name='fk_${fkName}_${relName}'#end 
    2222#end 
    2323 
    2424#macro( fk $foreignKey, $tableModel) 
    2525#set ($fkName = ${foreignKey.tableModel.associatedClass.name.toLowerCase()}) 
    26 #set ($relName = ${foreignKey.parentAttributeName}) 
     26#set ($relName = ${foreignKey.parentAttributeName.toLowerCase()}) 
    2727#if($foreignKey.associatedRelationship.isOneToOne() || !$foreignKey.associatedRelationship.useList) 
    28 Column('${fkName}_${relName}_id', Integer, ForeignKey('${fkName}.id'#checkUseAlter($foreignKey, $fkName))), 
     28Column('${fkName}_${relName}_id', Integer, ForeignKey('${fkName}.id'#checkUseAlter($foreignKey, $fkName, $relName))), 
    2929#else 
    30 Column('${fkName}_${relName}', Integer, ForeignKey('${fkName}.id'#checkUseAlter($foreignKey, $fkName))), 
     30Column('${fkName}_${relName}', Integer, ForeignKey('${fkName}.id'#checkUseAlter($foreignKey, $fkName, $relName))), 
    3131#end 
    3232#end 
Note: See TracChangeset for help on using the changeset viewer.