polymorphic_identity is intended to link to the "class" of an entity  
in a one-to-one fashion, so using a date type for this column would  
not be an appropriate usage.    We have eventual plans to support  
polymorphic_identity supplied by a function but that feature is  
currently not implemented.

You might consider looking into MapperExtension.create_instance() for  
this use case.

On Feb 5, 2009, at 10:24 AM, Toby Bradshaw wrote:

>
> Hi,
>
> So I (think I) understand that that polymorphic_on and
> polymorphic_identity can be used to determine which class is
> instantiated for a query result row. Is there any way I can use a  
> range
> of values for polymorphic_identity to map to the same class ? Of
> specific interest to me right now are date ranges and single-table
> inheritance.
>
> e.g. I have two classes: Employee and CurrentEmployee. Both are mapped
> to the same table, employee, but Employee.query() should return every
> record in the table and CurrentEmployee() should return the same  
> subset
> as Employee.query(Employee.start_date >= today), for example.
>
> It really is just a convenience thing so not a show stopper but  
> would be
> nice to know if this kind of thing is straightforwardly possible.
>
> -- 
> t o b e
> --
> A truly clever developer will create code so easy to understand that  
> a less than average developer could debug it.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to