Hibernate supports discriminator columns, but they went through all the effort 
to have polymorphic loading work by doing a LEFT OUTER JOIN of all involved 
tables, then they see which columns are present in order to check.

SQLAlchemy can do it, if you set up a full "with_polymorphic" join of all the 
tables, then use a CASE statement against all the tables to determine the 
discriminator.

The approach overall is highly inefficient, however, and makes it almost 
impossible to construct a join of your core entity to other entities because 
you end up with half a dozen or more JOIN/LEFT OUTER JOIN and your query grinds 
to a halt.

The discriminator-on-base table approach is simple, more versatile, and 
produces much more efficient queries, so that's why we stick with it.


On May 25, 2013, at 12:48 AM, Alex Grönholm <[email protected]> wrote:

> I used joined table inheritance in Hibernate and it worked fine without any 
> extra discriminator columns. Why is it necessary in SQLAlchemy?
> I can understand the need for such a column in single table inheritance, but 
> not joined table.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to