On Tue, 2008-12-09 at 12:38 -0500, Michael Bayer wrote: > > On Dec 9, 2008, at 5:08 AM, Julien Cigar wrote: > > > > > > > My question is: do I need to explicitely specify the join condition > > when > > inheritance is involved ? Why is SQLAlchemy able to detect the join > > condition for my "Content" (line 127) but not for my "Folder" (line > > 128) ? > > Folder extends Content and a FolderContent has two foreign key > references to folder.join(content). I would also collapse > FolderContent.folder and Folder.items into a single bidirectional > relation. I have something I might commit today that would improve > upon that though.... > >
Indeed, it works with : mapper(Folder, table.folder, inherits=Content, polymorphic_identity=_get_type_id('folder'), properties = { 'items' : relation(FolderContent, cascade='all, delete-orphan', backref=backref('folder', cascade='all, delete-orphan', primaryjoin=table.folder.c.content_id == table.folder_content.c.folder_id ) ) } ) thanks, Julien > > > -- Julien Cigar Belgian Biodiversity Platform http://www.biodiversity.be Université Libre de Bruxelles (ULB) Campus de la Plaine CP 257 Bâtiment NO, Bureau 4 N4 115C (Niveau 4) Boulevard du Triomphe, entrée ULB 2 B-1050 Bruxelles Mail: [EMAIL PROTECTED] @biobel: http://biobel.biodiversity.be/person/show/471 Tel : 02 650 57 52 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---