diff options
| author | Phillip Cloud <cpcloud@gmail.com> | 2016-05-01 17:56:35 -0700 |
|---|---|---|
| committer | Phillip Cloud <cpcloud@gmail.com> | 2016-05-01 17:56:35 -0700 |
| commit | 77fe28546e7124205e50c769f203f8330e35bac7 (patch) | |
| tree | 3f234d9def153f6358bdd3490081bb5112966e6b /doc | |
| parent | 9a3c9ba7beb18dfd6232deb895528ea8593a12b0 (diff) | |
| download | sqlalchemy-pr/264.tar.gz | |
Add window frame specificationpr/264
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/build/core/tutorial.rst | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/build/core/tutorial.rst b/doc/build/core/tutorial.rst index 0fd78abeb..7b28b1911 100644 --- a/doc/build/core/tutorial.rst +++ b/doc/build/core/tutorial.rst @@ -1423,7 +1423,22 @@ OVER clause, using the :meth:`.FunctionElement.over` method: ... func.row_number().over(order_by=users.c.name) ... ]) >>> print(s) - SELECT users.id, row_number() OVER (ORDER BY users.name) AS anon_1 + SELECT users.id, row_number() OVER (ORDER BY users.name RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS anon_1 + FROM users + +.. versionadded:: 1.2 + + You can provide a window frame specification using either the ``rows`` or + ``range`` parameter: + +.. sourcecode:: pycon+sql + + >>> s = select([ + ... users.c.id, + ... func.row_number().over(order_by=users.c.name, rows={'preceding': 2, 'following': 3}) + ... ]) + >>> print(s) + SELECT users.id, row_number() OVER (ORDER BY users.name ROWS BETWEEN 2 PRECEDING and 3 FOLLOWING) AS anon_1 FROM users .. seealso:: |
