From: Mike Bayer Date: Thu, 18 Feb 2016 16:33:19 +0000 (-0500) Subject: - further edit the unnest() example to suit PG's esoteric requirements X-Git-Tag: rel_1_1_0b1~98^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c97aa63789036fc145503f03123275253ae02d2c;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - further edit the unnest() example to suit PG's esoteric requirements exactly --- diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 9dfcadf19d..e6df070566 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -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