On Nov 2, 2006, at 11:47 PM, Randall Smith wrote:

>
> Is there a way to inherit more than one level for single table
> inheritance?  Take this relationship for example:
>
>      Animal -> Dog -> German Shepard
>
> Say there are 10 animals; 5 are dogs and 2 are German Shepard.
>
>      session.query(Animal).select() # Should yield 10 results.
>      session.query(Dog).select() # Should yield 5 results.
>      session.query(GermanShepard).select() # Should yield 2 results.
>

not unless you apply the attached patch, and/or update to rev 2084.



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

Attachment: single.patch
Description: Binary data

> Second question.  Can the "polymorphic_identity" be extracted
> functionally?  Say that in the "type" column I have data like this:
>
>      type                 value
>      ---------------      --------
>      default_heaters      electric
>      default_heaters      gas
>      default_floors       vinyl
>      default_floors       carpet
>
> All 4 records are DefaultAmenity instances, 2 are DefaultHeater and 2
> are DefaultFloor.  The latter two inherit from the first.   
> Identifying a
> DefaultAmenity record using the type column would require something  
> like
>   table.c.type.startswith('default').
>

if i understand correctly you could just query  that yourself, i.e.  
session.query(SomeObject).select(table.c.type.startswith 
('default')) .  i dont really understand what feature would be added  
to SA in this case.


Reply via email to