From: Mike Bayer Date: Wed, 30 Aug 2017 16:23:31 +0000 (-0400) Subject: Ignore SQL Server "heap" indexes X-Git-Tag: origin~35^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3e855cd277aac8a71be31082cbc11927005f5b37;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Ignore SQL Server "heap" indexes 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 --- diff --git a/doc/build/changelog/unreleased_12/4059.rst b/doc/build/changelog/unreleased_12/4059.rst new file mode 100644 index 0000000000..bedbdd17de --- /dev/null +++ b/doc/build/changelog/unreleased_12/4059.rst @@ -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. + diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index 05381d671e..d526c685ca 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -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)),