Cher tout le monde, je suis la relation plusieurs à plusieurs décrit sur http://www.sqlalchemy.org/docs/mappers.html#many-to-manysqlalchemy: many to many erreur de relation
#This is actually a VIEW
tb_mapping_uGroups_uProducts = Table('mapping_uGroups_uProducts', metadata,
Column('upID', Integer, ForeignKey('uProductsInfo.upID')),
Column('ugID', Integer, ForeignKey('uGroupsInfo.ugID'))
)
tb_uProducts = Table('uProductsInfo', metadata,
Column('upID', Integer, primary_key=True)
)
mapper(UnifiedProduct, tb_uProducts)
tb_uGroupsInfo = Table('uGroupsInfo', metadata,
Column('ugID', Integer, primary_key=True)
)
mapper(UnifiedGroup, tb_uGroupsInfo, properties={
'unifiedProducts': relation(UnifiedProduct, secondary=tb_mapping_uGroups_uProducts, backref="unifiedGroups")
})
où la relation entre uProduct et uGroup sont N: M.
Quand je lance ce qui suit
sess.query(UnifiedProduct).join(UnifiedGroup).distinct()[:10]
Je reçois l'erreur:
sqlalchemy.exc.ArgumentError: Can't find any foreign key relationships between 'uProductsInfo' and 'uGroupsInfo'
Qu'est-ce que je fais mal?
EDIT: Je suis sur MyISAM qui ne supporte pas les clés forigen