summaryrefslogtreecommitdiff
path: root/test/dialect/mssql/test_compiler.py
diff options
context:
space:
mode:
authormollardthomas <mollardthomas@gmail.com>2019-05-03 11:31:57 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2019-05-06 18:11:42 -0400
commit174f2ae33b5235d709b17f3371946a173defaa0d (patch)
treed1893216bc2ba92fdf823c2b557209ef5a91c2b1 /test/dialect/mssql/test_compiler.py
parent1c3e92627362604472ca483055fc827a97942e6b (diff)
downloadsqlalchemy-174f2ae33b5235d709b17f3371946a173defaa0d.tar.gz
Add support for filtered indexes for mssql dialect
Added support for SQL Server filtered indexes, via the ``mssql_where`` parameter which works similarly to that of the ``postgresql_where`` index function in the PostgreSQL dialect. Fixes: #4657 Closes: #4658 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/4658 Pull-request-sha: cf609c19bccc74c0dba38d2fc4976df3a205f3f6 Change-Id: I9c61b97d0b0cb6f6d417da7b1875b40f8f918a3c
Diffstat (limited to 'test/dialect/mssql/test_compiler.py')
-rw-r--r--test/dialect/mssql/test_compiler.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/dialect/mssql/test_compiler.py b/test/dialect/mssql/test_compiler.py
index 339cc7590..30a11d16b 100644
--- a/test/dialect/mssql/test_compiler.py
+++ b/test/dialect/mssql/test_compiler.py
@@ -1129,6 +1129,15 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
schema.CreateIndex(idx), "CREATE CLUSTERED INDEX foo ON test (id)"
)
+ def test_index_where(self):
+ metadata = MetaData()
+ tbl = Table("test", metadata, Column("data", Integer))
+ idx = Index("test_idx_data_1", tbl.c.data, mssql_where=tbl.c.data > 1)
+ self.assert_compile(
+ schema.CreateIndex(idx),
+ "CREATE INDEX test_idx_data_1 ON test (data) WHERE data > 1"
+ )
+
def test_index_ordering(self):
metadata = MetaData()
tbl = Table(