From: Mike Bayer Date: Sat, 21 Nov 2009 20:51:16 +0000 (+0000) Subject: add an interesting from_statement() format X-Git-Tag: rel_0_6beta1~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=66b7d008ee2975744212fc1b3831375b15db055f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git add an interesting from_statement() format --- diff --git a/doc/build/ormtutorial.rst b/doc/build/ormtutorial.rst index b1f647e51b..d23834c0db 100644 --- a/doc/build/ormtutorial.rst +++ b/doc/build/ormtutorial.rst @@ -581,6 +581,15 @@ To use an entirely string-based statement, using ``from_statement()``; just ensu ['ed'] {stop}[] +You can use ``from_statement()`` to go completely "raw", using string names to identify desired columns: + +.. sourcecode:: python+sql + + {sql}>>> session.query("id", "name", "thenumber12").from_statement("SELECT id, name, 12 as thenumber12 FROM users where name=:name").params(name='ed').all() + SELECT id, name, 12 as thenumber12 FROM users where name=? + ['ed'] + {stop}[(1, u'ed', 12)] + Counting --------