On Jul 16, 2010, at 7:34 AM, Julien Cigar wrote: > Hello, > > I have the following mappers: > > orm.mapper(Content, table.content, > polymorphic_on = table.content.c.content_type_id, > ...) > > orm.mapper(News, table.news, inherits = Content, > polymorphic_on = table.content.c.content_type_id) > > orm.mapper(PlatformNews, table.platform_news, inherits = News, > polymorphic_identity = _get_type_id('platform news')) > > When I do: > > Content.query.with_polymorphic([PlatformNews]) > > SQLAlchemy forgot to add a JOIN for the news (News) table (because there is > more than one level of inheritance I guess), I wondered if there was a way to > do that automatically ?
not sure here but the two possibiltiies are: the extra polymorphic_on, or perhaps the with_polymorphic() call. I only say that because the second polymorphic_on is not what the mapper expects and we have a lot of tests for a->b->c inheritance which work fine. At least, you should only have the polymorphic_on defined on the Content table. I'm not sure we've exercised with_polymorphic() as much with multilevel, so perhaps you should place News in that list as well as a workaround for now (or join to the tables directly). > > Thanks, > Julien > > -- > No trees were killed in the creation of this message. > However, many electrons were terribly inconvenienced. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalch...@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > > <jcigar.vcf> -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.