]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- fix some old verbiage that refers to text() as an "implicit" thing
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Jan 2016 22:18:21 +0000 (17:18 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 14 Jan 2016 22:18:21 +0000 (17:18 -0500)
for SQL fragments; we've deprecated that in 1.0 and its a good idea
to document like this for 0.9 as well.

lib/sqlalchemy/sql/elements.py

index 774e42609d51c80e62eb390f6cecba96fe7bbb8f..7c16f97855219e6ced846bcc1b743661e754286c 100644 (file)
@@ -1276,17 +1276,16 @@ class TextClause(Executable, ClauseElement):
             for id, name in connection.execute(t):
                 print(id, name)
 
-        The :func:`.text` construct is used internally in cases when
-        a literal string is specified for part of a larger query, such as
-        when a string is specified to the :meth:`.Select.where` method of
-        :class:`.Select`.  In those cases, the same
-        bind parameter syntax is applied::
+        The :func:`.text` construct is used in cases when
+        a literal string SQL fragment is specified as part of a larger query,
+        such as for the WHERE clause of a SELECT statement::
 
-            s = select([users.c.id, users.c.name]).where("id=:user_id")
+            s = select([users.c.id, users.c.name]).where(text("id=:user_id"))
             result = connection.execute(s, user_id=12)
 
-        Using :func:`.text` explicitly usually implies the construction
-        of a full, standalone statement.   As such, SQLAlchemy refers
+        :func:`.text` is also used for the construction
+        of a full, standalone statement using plain text.
+        As such, SQLAlchemy refers
         to it as an :class:`.Executable` object, and it supports
         the :meth:`Executable.execution_options` method.  For example,
         a :func:`.text` construct that should be subject to "autocommit"