:ref:`lateral_selects` - overview of usage.
"""
- return selectable.lateral(name=name)
+ return _interpret_as_from(selectable).lateral(name=name)
+ def tablesample(selectable, sampling, name=None, seed=None):
+ """Return a :class:`.TableSample` object.
+
+ :class:`.TableSample` is an :class:`.Alias` subclass that represents
+ a table with the TABLESAMPLE clause applied to it.
+ :func:`~.expression.tablesample`
+ is also available from the :class:`.FromClause` class via the
+ :meth:`.FromClause.tablesample` method.
+
+ The TABLESAMPLE clause allows selecting a randomly selected approximate
+ percentage of rows from a table. It supports multiple sampling methods,
+ most commonly BERNOULLI and SYSTEM.
+
+ e.g.::
+
+ from sqlalchemy import func
+
+ selectable = people.tablesample(
+ func.bernoulli(1),
+ name='alias',
+ seed=func.random())
+ stmt = select([selectable.c.people_id])
+
+ Assuming ``people`` with a column ``people_id``, the above
+ statement would render as::
+
+ SELECT alias.people_id FROM
+ people AS alias TABLESAMPLE bernoulli(:bernoulli_1)
+ REPEATABLE (random())
+
+ .. versionadded:: 1.1
+
+ :param sampling: a ``float`` percentage between 0 and 100 or
+ :class:`.functions.Function`.
+
+ :param name: optional alias name
+
+ :param seed: any real-valued SQL expression. When specified, the
+ REPEATABLE sub-clause is also rendered.
+
+ """
+ return _interpret_as_from(selectable).tablesample(
+ sampling, name=name, seed=seed)
+
+
class Selectable(ClauseElement):
"""mark a class as being selectable"""
__visit_name__ = 'selectable'