Michael Bayer wrote:
> just FYI, the "type" column idea is taken from Hibernate, and that's
> all Hibernate supports as far as polymorphic loading.
I think it's good that SA takes good features from and is similar to
Hibernate, but I hope that your aspirations and those of SA's users are
to make SA much better than Hibernate. I think Python vs. Java/XML (I
despise the XML modeling) is already a boost for SA. SA is amazing and
I've got high hopes for its future.
>
> But for polymorphic loading in SA, you are free to make any kind of
> "polymorphic_union" you like that can add in a functionally-generated
> "type" column, and specify it into select_table. im pretty sure this
> should work completely right now, such as:
>
> import sqlalchemy.sql as sql
>
> person_join = polymorphic_union(
> {
> 'engineer':sql.select([people.join(engineers),
> sql.column("'engineer'").label('type')]),
> 'manager':sql.select([people.join(managers),
> sql.column("'manager'").label('type')]),
> }
> )
>
> etc.
>
Thanks for code example. I suspect that's the approach I'll be using
most often.
Randall
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---