]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Ignore SQL Server "heap" indexes
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 30 Aug 2017 16:23:31 +0000 (12:23 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 30 Aug 2017 16:27:03 +0000 (12:27 -0400)
Added a rule to SQL Server index reflection to ignore the so-called
"heap" index that is implicitly present on a table that does not
specify a clustered index.

Tests are part of standard suite already (CI has been disabled)

Change-Id: I593b95551c40ee5d95d54203611112cbff10856f
Fixes: #4059
doc/build/changelog/unreleased_12/4059.rst [new file with mode: 0644]
lib/sqlalchemy/dialects/mssql/base.py

diff --git a/doc/build/changelog/unreleased_12/4059.rst b/doc/build/changelog/unreleased_12/4059.rst
new file mode 100644 (file)
index 0000000..bedbdd1
--- /dev/null
@@ -0,0 +1,8 @@
+.. change::
+    :tags: bug, mssql
+    :tickets: 4059
+
+    Added a rule to SQL Server index reflection to ignore the so-called
+    "heap" index that is implicitly present on a table that does not
+    specify a clustered index.
+
index 05381d671ea8a5130f0b7a0056e678638f82f805..d526c685ca1c850146cbceea03d1cb54c89dc15b 100644 (file)
@@ -1939,7 +1939,7 @@ class MSDialect(default.DefaultDialect):
                      "join sys.schemas as sch on sch.schema_id=tab.schema_id "
                      "where tab.name = :tabname "
                      "and sch.name=:schname "
-                     "and ind.is_primary_key=0",
+                     "and ind.is_primary_key=0 and ind.type != 0",
                      bindparams=[
                          sql.bindparam('tabname', tablename,
                                        sqltypes.String(convert_unicode=True)),