MS SQL: non-IDENTITY PK columns on reflected tables

Issue #824 resolved
Former user created an issue

When reflecting table schema on MS SQL, the autoincrement property should not be set on non-IDENTITY PK columns. Doing so causes save() attempts to call "SET IDENTITY_INSERT ON", which causes an exception.

Attached patch solves this by disabling autoincrement on all reflected columns, then explicitly setting it True when handling IDENTITY columns.

Note: I would normally be happy to attach a test case for this bug, but I don't know how to properly mock the objects and entities involved in an acceptable way to make the test run with no dependencies other than pure Python. Since it involves schema reflection, it would require a mock database at the very least. (This seems like a state of diminishing returns for a two-line patch.)

Comments (2)

  1. Log in to comment