]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- further edit the unnest() example to suit PG's esoteric requirements
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Feb 2016 16:33:19 +0000 (11:33 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Feb 2016 16:33:19 +0000 (11:33 -0500)
exactly

lib/sqlalchemy/sql/functions.py

index 9dfcadf19de8313daae3ac516dc9abad9c9fdb54..e6df070566d3ea1e977db0559597e66e0f4a34e5 100644 (file)
@@ -189,14 +189,16 @@ class FunctionElement(Executable, ColumnElement, FromClause):
         :class:`.FunctionElement`.
 
         This construct wraps the function in a named alias which
-        is suitable for the FROM clause.
+        is suitable for the FROM clause, in the style accepted for example
+        by Postgresql.
 
         e.g.::
 
             from sqlalchemy.sql import column
 
-            stmt = select([column('data_view')]).select_from(
-                func.unnest(Table.data).alias('data_view')
+            stmt = select([column('data_view')]).\\
+                select_from(SomeTable).\\
+                select_from(func.unnest(SomeTable.data).alias('data_view')
             )
 
         Would produce:
@@ -204,7 +206,7 @@ class FunctionElement(Executable, ColumnElement, FromClause):
         .. sourcecode:: sql
 
             SELECT data_view
-            FROM unnest(sometable.data) AS data_view
+            FROM sometable, unnest(sometable.data) AS data_view
 
         .. versionadded:: 0.9.8 The :meth:`.FunctionElement.alias` method
            is now supported.  Previously, this method's behavior was