summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2016-06-15 15:17:10 -0400
committerGerrit Code Review <gerrit2@ln3.zzzcomputing.com>2016-06-15 15:17:10 -0400
commit5c80400ec7c5631d251bac43342637637b9c8214 (patch)
treebc12c870a429a6ebd9d4882cbf2e24bf4d3302bf /doc
parentecca1f814e6af9c84e24ee05929f5a8455846f40 (diff)
parent20f2f5b169d35cfee7cc21ff697e23fd00858171 (diff)
downloadsqlalchemy-5c80400ec7c5631d251bac43342637637b9c8214.tar.gz
Merge "Add TABLESAMPLE clause support."
Diffstat (limited to 'doc')
-rw-r--r--doc/build/changelog/changelog_11.rst11
-rw-r--r--doc/build/changelog/migration_11.rst26
-rw-r--r--doc/build/core/selectable.rst6
3 files changed, 43 insertions, 0 deletions
diff --git a/doc/build/changelog/changelog_11.rst b/doc/build/changelog/changelog_11.rst
index 7194ac116..534c3993c 100644
--- a/doc/build/changelog/changelog_11.rst
+++ b/doc/build/changelog/changelog_11.rst
@@ -22,6 +22,17 @@
:version: 1.1.0b1
.. change::
+ :tags: feature, sql
+ :tickets: 3718
+
+ Added TABLESAMPLE support via the new :meth:`.FromClause.tablesample`
+ method and standalone function. Pull request courtesy Ilja Everilä.
+
+ .. seealso::
+
+ :ref:`change_3718`
+
+ .. change::
:tags: feature, orm, ext
A new ORM extension :ref:`indexable_toplevel` is added, which allows
diff --git a/doc/build/changelog/migration_11.rst b/doc/build/changelog/migration_11.rst
index 766b06f2e..f6e04225d 100644
--- a/doc/build/changelog/migration_11.rst
+++ b/doc/build/changelog/migration_11.rst
@@ -1150,6 +1150,32 @@ selectable, e.g. lateral correlation::
:ticket:`2857`
+.. _change_3718:
+
+Support for TABLESAMPLE
+-----------------------
+
+The SQL standard TABLESAMPLE can be rendered using the
+:meth:`.FromClause.tablesample` method, which returns a :class:`.TableSample`
+construct similar to an alias::
+
+ 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())
+
+:ticket:`3718`
+
.. _change_3216:
The ``.autoincrement`` directive is no longer implicitly enabled for a composite primary key column
diff --git a/doc/build/core/selectable.rst b/doc/build/core/selectable.rst
index 263594d24..f4860165f 100644
--- a/doc/build/core/selectable.rst
+++ b/doc/build/core/selectable.rst
@@ -33,6 +33,8 @@ elements are themselves :class:`.ColumnElement` subclasses).
.. autofunction:: sqlalchemy.sql.expression.table
+.. autofunction:: tablesample
+
.. autofunction:: union
.. autofunction:: union_all
@@ -93,6 +95,10 @@ elements are themselves :class:`.ColumnElement` subclasses).
:members:
:inherited-members:
+.. autoclass:: TableSample
+ :members:
+ :inherited-members:
+
.. autoclass:: TextAsFrom
:members:
:inherited-members: