> this is normal, loading for the base class only hits those columns which
> are defined for that base class - it does not automatically fan out to all
> columns mapped by all subclasses.
>
to do so, you can specify with_polymorphic:
>

Ahh, thank you very much Michael that does do exactly what I want. So many
times in SQLAlchemy I have been rummaging and hacking for days and then
there's a simple one liner that does exactly what I was after all along :)

One problem remains though. I use a Query.from_self() which seems to cause
SA to forget about the with_polymorphic setting I have given in
mapper_args. If I try to remind it, by explicitly saying
my_query.with_polymorphic("*") I get errors like this:

> Query.with_polymorphic() being called on a Query with existing criterion.

Which seems to be related in some way to having a .distinct or .order_by
clause in the query. Is this expected/understood?

Thank you so much for your help!

All the best,

Philip

-- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to