@@ -1742,14 +1742,42 @@ def _offset(self):
1742
1742
@_generative
1743
1743
def limit (self , limit ):
1744
1744
"""return a new selectable with the given LIMIT criterion
1745
- applied."""
1745
+ applied.
1746
+
1747
+ This is a numerical value which usually renders as a ``LIMIT``
1748
+ expression in the resulting select. Backends that don't
1749
+ support ``LIMIT`` will attempt to provide similar
1750
+ functionality.
1751
+
1752
+ .. versionchanged:: 1.0.0 - :meth:`.Select.limit` can now
1753
+ accept arbitrary SQL expressions as well as integer values.
1754
+
1755
+ :param limit: an integer LIMIT parameter, or a SQL expression
1756
+ that provides an integer result.
1757
+
1758
+ """
1746
1759
1747
1760
self ._limit_clause = _offset_or_limit_clause (limit )
1748
1761
1749
1762
@_generative
1750
1763
def offset (self , offset ):
1751
1764
"""return a new selectable with the given OFFSET criterion
1752
- applied."""
1765
+ applied.
1766
+
1767
+
1768
+ This is a numeric value which usually renders as an ``OFFSET``
1769
+ expression in the resulting select. Backends that don't
1770
+ support ``OFFSET`` will attempt to provide similar
1771
+ functionality.
1772
+
1773
+
1774
+ .. versionchanged:: 1.0.0 - :meth:`.Select.offset` can now
1775
+ accept arbitrary SQL expressions as well as integer values.
1776
+
1777
+ :param offset: an integer OFFSET parameter, or a SQL expression
1778
+ that provides an integer result.
1779
+
1780
+ """
1753
1781
1754
1782
self ._offset_clause = _offset_or_limit_clause (offset )
1755
1783
@@ -2156,38 +2184,57 @@ def __init__(self,
2156
2184
:func:`.select`.
2157
2185
2158
2186
:param columns:
2159
- A list of :class:`.ClauseElement` objects, typically
2160
- :class:`.ColumnElement` objects or subclasses, which will form the
2161
- columns clause of the resulting statement. For all members which are
2162
- instances of :class:`.Selectable`, the individual
2163
- :class:`.ColumnElement` members of the :class:`.Selectable` will be
2164
- added individually to the columns clause. For example, specifying a
2165
- :class:`~sqlalchemy.schema.Table` instance will result in all the
2166
- contained :class:`~sqlalchemy.schema.Column` objects within to be
2167
- added to the columns clause.
2168
-
2169
- This argument is not present on the form of :func:`select()`
2170
- available on :class:`~sqlalchemy.schema.Table`.
2187
+ A list of :class:`.ColumnElement` or :class:`.FromClause`
2188
+ objects which will form the columns clause of the resulting
2189
+ statement. For those objects that are instances of
2190
+ :class:`.FromClause` (typically :class:`.Table` or :class:`.Alias`
2191
+ objects), the :attr:`.FromClause.c` collection is extracted
2192
+ to form a collection of :class:`.ColumnElement` objects.
2193
+
2194
+ This parameter will also accept :class:`.Text` constructs as
2195
+ given, as well as ORM-mapped classes.
2196
+
2197
+ .. note::
2198
+
2199
+ The :paramref:`.select.columns` parameter is not available
2200
+ in the method form of :func:`.select`, e.g.
2201
+ :meth:`.FromClause.select`.
2202
+
2203
+ .. seealso::
2204
+
2205
+ :meth:`.Select.column`
2206
+
2207
+ :meth:`.Select.with_only_columns`
2171
2208
2172
2209
:param whereclause:
2173
2210
A :class:`.ClauseElement` expression which will be used to form the
2174
- ``WHERE`` clause.
2211
+ ``WHERE`` clause. It is typically preferable to add WHERE
2212
+ criterion to an existing :class:`.Select` using method chaining
2213
+ with :meth:`.Select.where`.
2214
+
2215
+ .. seealso::
2216
+
2217
+ :meth:`.Select.where`
2175
2218
2176
2219
:param from_obj:
2177
2220
A list of :class:`.ClauseElement` objects which will be added to the
2178
- ``FROM`` clause of the resulting statement. Note that "from" objects
2179
- are automatically located within the columns and whereclause
2180
- ClauseElements. Use this parameter to explicitly specify "from"
2181
- objects which are not automatically locatable. This could include
2182
- :class:`~sqlalchemy.schema.Table` objects that aren't otherwise
2183
- present, or :class:`.Join` objects whose presence will supersede
2184
- that of the :class:`~sqlalchemy.schema.Table` objects already
2185
- located in the other clauses .
2221
+ ``FROM`` clause of the resulting statement. This is equivalent
2222
+ to calling :meth:`.Select.select_from` using method chaining on
2223
+ an existing :class:`.Select` object.
2224
+
2225
+ .. seealso::
2226
+
2227
+ :meth:`.Select.select_from` - full description of explicit
2228
+ FROM clause specification .
2186
2229
2187
2230
:param autocommit:
2188
- Deprecated. Use .execution_options(autocommit=<True|False>)
2231
+ Deprecated. Use `` .execution_options(autocommit=<True|False>)``
2189
2232
to set the autocommit option.
2190
2233
2234
+ .. seealso::
2235
+
2236
+ :meth:`.Executable.execution_options`
2237
+
2191
2238
:param bind=None:
2192
2239
an :class:`~.Engine` or :class:`~.Connection` instance
2193
2240
to which the
@@ -2199,11 +2246,13 @@ def __init__(self,
2199
2246
:param correlate=True:
2200
2247
indicates that this :class:`.Select` object should have its
2201
2248
contained :class:`.FromClause` elements "correlated" to an enclosing
2202
- :class:`.Select` object. This means that any
2203
- :class:`.ClauseElement` instance within the "froms" collection of
2204
- this :class:`.Select` which is also present in the "froms"
2205
- collection of an enclosing select will not be rendered in the
2206
- ``FROM`` clause of this select statement.
2249
+ :class:`.Select` object. It is typically preferable to specify
2250
+ correlations on an existing :class:`.Select` construct using
2251
+ :meth:`.Select.correlate`.
2252
+
2253
+ .. seealso::
2254
+
2255
+ :meth:`.Select.correlate` - full description of correlation.
2207
2256
2208
2257
:param distinct=False:
2209
2258
when ``True``, applies a ``DISTINCT`` qualifier to the columns
@@ -2214,15 +2263,19 @@ def __init__(self,
2214
2263
is understood by the Postgresql dialect to render the
2215
2264
``DISTINCT ON (<columns>)`` syntax.
2216
2265
2217
- ``distinct`` is also available via the :meth:`~.Select.distinct`
2218
- generative method.
2266
+ ``distinct`` is also available on an existing :class:`.Select`
2267
+ object via the :meth:`~.Select.distinct` method.
2268
+
2269
+ .. seealso::
2270
+
2271
+ :meth:`.Select.distinct`
2219
2272
2220
2273
:param for_update=False:
2221
2274
when ``True``, applies ``FOR UPDATE`` to the end of the
2222
2275
resulting statement.
2223
2276
2224
2277
.. deprecated:: 0.9.0 - use
2225
- :meth:`.GenerativeSelect .with_for_update` to specify the
2278
+ :meth:`.Select .with_for_update` to specify the
2226
2279
structure of the ``FOR UPDATE`` clause.
2227
2280
2228
2281
``for_update`` accepts various string values interpreted by
@@ -2237,32 +2290,62 @@ def __init__(self,
2237
2290
2238
2291
.. seealso::
2239
2292
2240
- :meth:`.GenerativeSelect .with_for_update` - improved API for
2293
+ :meth:`.Select .with_for_update` - improved API for
2241
2294
specifying the ``FOR UPDATE`` clause.
2242
2295
2243
2296
:param group_by:
2244
2297
a list of :class:`.ClauseElement` objects which will comprise the
2245
- ``GROUP BY`` clause of the resulting select.
2298
+ ``GROUP BY`` clause of the resulting select. This parameter
2299
+ is typically specified more naturally using the
2300
+ :meth:`.Select.group_by` method on an existing :class:`.Select`.
2301
+
2302
+ .. seealso::
2303
+
2304
+ :meth:`.Select.group_by`
2246
2305
2247
2306
:param having:
2248
2307
a :class:`.ClauseElement` that will comprise the ``HAVING`` clause
2249
- of the resulting select when ``GROUP BY`` is used.
2308
+ of the resulting select when ``GROUP BY`` is used. This parameter
2309
+ is typically specified more naturally using the
2310
+ :meth:`.Select.having` method on an existing :class:`.Select`.
2311
+
2312
+ .. seealso::
2313
+
2314
+ :meth:`.Select.having`
2250
2315
2251
2316
:param limit=None:
2252
- a numerical value which usually compiles to a ``LIMIT``
2253
- expression in the resulting select. Databases that don't
2317
+ a numerical value which usually renders as a ``LIMIT``
2318
+ expression in the resulting select. Backends that don't
2254
2319
support ``LIMIT`` will attempt to provide similar
2255
- functionality.
2320
+ functionality. This parameter is typically specified more naturally
2321
+ using the :meth:`.Select.limit` method on an existing
2322
+ :class:`.Select`.
2323
+
2324
+ .. seealso::
2325
+
2326
+ :meth:`.Select.limit`
2256
2327
2257
2328
:param offset=None:
2258
- a numeric value which usually compiles to an ``OFFSET``
2259
- expression in the resulting select. Databases that don't
2329
+ a numeric value which usually renders as an ``OFFSET``
2330
+ expression in the resulting select. Backends that don't
2260
2331
support ``OFFSET`` will attempt to provide similar
2261
- functionality.
2332
+ functionality. This parameter is typically specified more naturally
2333
+ using the :meth:`.Select.offset` method on an existing
2334
+ :class:`.Select`.
2335
+
2336
+ .. seealso::
2337
+
2338
+ :meth:`.Select.offset`
2262
2339
2263
2340
:param order_by:
2264
2341
a scalar or list of :class:`.ClauseElement` objects which will
2265
2342
comprise the ``ORDER BY`` clause of the resulting select.
2343
+ This parameter is typically specified more naturally using the
2344
+ :meth:`.Select.order_by` method on an existing :class:`.Select`.
2345
+
2346
+ .. seealso::
2347
+
2348
+ :meth:`.Select.order_by`
2266
2349
2267
2350
:param use_labels=False:
2268
2351
when ``True``, the statement will be generated using labels
@@ -2273,8 +2356,13 @@ def __init__(self,
2273
2356
collection of the resulting :class:`.Select` object will use these
2274
2357
names as well for targeting column members.
2275
2358
2276
- use_labels is also available via the
2277
- :meth:`~.GenerativeSelect.apply_labels` generative method.
2359
+ This parameter can also be specified on an existing
2360
+ :class:`.Select` object using the :meth:`.Select.apply_labels`
2361
+ method.
2362
+
2363
+ .. seealso::
2364
+
2365
+ :meth:`.Select.apply_labels`
2278
2366
2279
2367
"""
2280
2368
self ._auto_correlate = correlate
0 commit comments