From: Mike Bayer Date: Mon, 27 Jul 2015 02:43:13 +0000 (-0400) Subject: - using text().columns() for ORM matching won't work well X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9490e64a28ca0633bb56c15291776ef67cae31b5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - using text().columns() for ORM matching won't work well until ticket #3501, so remove this from pre-1.1 tutorials (cherry picked from commit 7240262adb5d74ec49abdd8561fca58b632c5e8e) --- diff --git a/doc/build/orm/tutorial.rst b/doc/build/orm/tutorial.rst index 0144c1e978..1d14f08866 100644 --- a/doc/build/orm/tutorial.rst +++ b/doc/build/orm/tutorial.rst @@ -968,31 +968,6 @@ mapper (below illustrated using an asterisk): ('ed',) {stop}[] -Or alternatively, specify how the columns map to the :func:`.text` construct -explicitly using the :meth:`.TextClause.columns` method: - -.. sourcecode:: python+sql - - >>> stmt = text("SELECT name, id FROM users where name=:name") - >>> stmt = stmt.columns(User.name, User.id) - {sql}>>> session.query(User).from_statement(stmt).params(name='ed').all() - SELECT name, id FROM users where name=? - ('ed',) - {stop}[] - -We can choose columns to return individually as well, as in any other case: - -.. sourcecode:: python+sql - - >>> stmt = text("SELECT name, id FROM users where name=:name") - >>> stmt = stmt.columns(User.name, User.id) - {sql}>>> session.query(User.id, User.name).\ - ... from_statement(stmt).params(name='ed').all() - SELECT name, id FROM users where name=? - ('ed',) - {stop}[(1, u'ed')] - - .. seealso:: :ref:`sqlexpression_text` - The :func:`.text` construct explained