From: Mike Bayer Date: Sat, 29 Oct 2005 02:37:46 +0000 (+0000) Subject: (no commit message) X-Git-Tag: rel_0_1_0~425 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=04ea58e273ffeac769c70760af91ab5aff335f28;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git --- diff --git a/doc/build/content/datamapping.myt b/doc/build/content/datamapping.myt index 1caed058ba..b4801bdf63 100644 --- a/doc/build/content/datamapping.myt +++ b/doc/build/content/datamapping.myt @@ -245,9 +245,13 @@ INSERT INTO article_keywords (article_id, keyword_id) VALUES (:article_id, :keyw [{'keyword_id': 1, 'article_id': 1}, {'keyword_id': 2, 'article_id': 1}] - # select articles based on some keywords. the extra selection criterion - # won't get in the way of the separate eager load of all the article's keywords - articles = Article.mapper.select(sql.and_(keywords.c.keyword_id==itemkeywords.c.keyword_id, itemkeywords.c.article_id==articles.c.article_id, keywords.c.name.in_('politics', 'entertainment'))) <&|formatting.myt:codepopper, link="sql" &> + # select articles based on some keywords. to select against joined criterion, we specify the + # join condition explicitly. the tables in the extra joined criterion + # will be given aliases at the SQL level so that they don't interfere with those of the JOIN + # already used for the eager load. + articles = Article.mapper.select(sql.and_(keywords.c.keyword_id==itemkeywords.c.keyword_id, + itemkeywords.c.article_id==articles.c.article_id, + keywords.c.name.in_('politics', 'entertainment'))) <&|formatting.myt:codepopper, link="sql" &> SELECT articles.article_id AS articles_article_id, articles.article_headline AS articles_article_headline, articles.article_body AS articles_article_body,