On Feb 18, 2008, at 10:34 AM, Julien Cigar wrote:
> > My question is: can I have a select() object which return a scalar for > the polymorphic_identity parameters ? I guess it should be possible to > put anything else than the FK value ? > theres no reason you cant map to select([content, content_type.c.name]).select_from(content.join(content_type)) . If you take that select and outerjoin it to both the "news" and "science_news" tables, you can stick it just under mapper(..., select_table=<select>) and keep the base tables simple. The caveat here is that you have to set either "content_type_id" or "content_type" (if the latter, by using a relation()) on each object manually. another option would be to just grab the integer "content_type_ids" really quick before configuring the mappers, and use the integer values directly for the "polymorphic_identity" field. we will eventually also be implementing a user-defineable callable for "polymorphic_on" too which could combine both approaches. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---
