]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- changelog / doc for sqlite partial indexes
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Mar 2015 18:18:35 +0000 (14:18 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Mar 2015 18:18:35 +0000 (14:18 -0400)
doc/build/changelog/changelog_09.rst
lib/sqlalchemy/dialects/sqlite/base.py

index c7bd272f28c362c8370b179393d3beb03a3491b0..1f583c44a08f8a747a52a8022c051037476f1c0a 100644 (file)
 .. changelog::
     :version: 0.9.9
 
+    .. change::
+        :tags: feature, sqlite
+        :pullreq: bitbucket:42
+
+        Added support for partial indexes (e.g. with a WHERE clause) on
+        SQLite.  Pull request courtesy Kai Groner.
+
+        .. seealso::
+
+            :ref:`sqlite_partial_index`
+
     .. change::
         :tags: bug, orm
         :tickets: 3310
index 437a7794acc6141c37d755dac6d6e4a48c3f5943..462a9f21fd292f578c5d0b542bbe49e3a1b4a190 100644 (file)
@@ -272,6 +272,26 @@ lookup is used instead:
 .. versionadded:: 0.9.3 Support for SQLite type affinity rules when reflecting
    columns.
 
+
+.. _sqlite_partial_index:
+
+Partial Indexes
+===============
+
+A partial index, e.g. one which uses a WHERE clause, can be specified
+with the DDL system using the argument ``sqlite_where``::
+
+    tbl = Table('testtbl', m, Column('data', Integer))
+    idx = Index('test_idx1', tbl.c.data,
+                sqlite_where=and_(tbl.c.data > 5, tbl.c.data < 10))
+
+The index will be rendered at create time as::
+
+    CREATE INDEX test_idx1 ON testtbl (data)
+    WHERE data > 5 AND data < 10
+
+.. versionadded:: 0.9.9
+
 """
 
 import datetime