Hi,

I did a quick search but couldn't find the "right" way to do this in
SA.

For the sake of example, I have a many-to-many relationshp between
Book and Reader.  The 'books' property of reader is loaded using
lazy='dynamic'.  And, finally, Book is mapped with single-table
inheritance and has subclasses for various genres.  -- this is just an
example :)

This works:
reader = session.query(Reader).first()
mysterybooks = reader.books.filter
(Book.genre==MysteryBook.DESCRIMINATOR_KEY)

However, this doesn't feel like the *right* way.  I experimented with
various forms of of_type() but didn't get it to work.  I'm sure I'm
just not fully understanding how that is supposed to work.

Thanks in advance!

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

Reply via email to