On Mon, 2008-02-18 at 10:58 -0500, Michael Bayer wrote:
> 
> 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.

yep, that sounds good :)

Maybe a stupid question, but is the way I wish to implement my "design"
above the "right" way to do it ?

> 
> we will eventually also be implementing a user-defineable callable for  
> "polymorphic_on" too which could combine both approaches.
> 
> > 
-- 
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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to