On Apr 3, 2008, at 1:30 PM, Chris Guin wrote:

>
> I've turned on debugging, and from what I can tell, it's not so much
> that it's occasionally coming out as NULL, so much as always going in
> as NULL - each of the INSERT INTO statements puts None into the
> discriminator field for the discriminators of all but the
> lowest-level superclasses.
>
> Here are the relevant mapper definitions:
>
> event_mapper = mapper(Event, event, select_table=event_join,
> polymorphic_on=event.c.discriminator, polymorphic_identity='event')
>
> detection_mapper = mapper(Detection, detection,
> select_table=detection_join,
> polymorphic_on=detection.c.discriminator, inherits=event_mapper,
> polymorphic_identity='detection')
>
> mapper(AspectDetection, aspect_detection, inherits=detection_mapper,
> polymorphic_identity='aspect_detection')
>
> mapper(RFDetection, rf_detection, inherits=detection_mapper,
> polymorphic_identity='rf_detection')
>
> -------------
>
> event.c.discriminator is always set to None,
> detection.c.discriminator is set correctly.
>
> Is there something I should be specifying that I'm not?


the opposite.  polymorphic_on should only be set on the Event mapper,  
and there should not be a discriminator column on the "detection"  
table.  The base "event" table needs to determine the type in all  
cases.  The reason for this is because when rows come in for the Event  
mapper, it only knows about the "event.discriminator" column - it has  
no knowledge that some partcular subclasses should be looking at a  
different column.  I'll add an assertion case for this now.






--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to