> if you set up backrefs on your Keyword mapper that stretch back to
> Session, you can use the query.join_to() function to make the above
> task easier.

With the backrefs set up the following worked just as you suggested:

>>> q = session.query(Keyword)
>>> q.select(and_(q.join_to('section'), section_table.c.name=='Health'))

[2006-10-07 18:57:19,519] [engine]: SELECT keyword.name AS keyword_name, ...
FROM keyword, item_keyword, item, section
WHERE ((keyword.uuid = item_keyword.keyword_uuid AND item.uuid =
item_keyword.item_uuid) AND section.id = item.section_id) AND
section.name = ? ORDER BY keyword.oid
[2006-10-07 18:57:19,519] [engine]: ['Health']

Thanks much.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to