Skip to content

Commit dfb97d4

Browse files
committed
get constraints with more strict ordering
1 parent 312538e commit dfb97d4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sql_server/pyodbc/introspection.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ def get_constraints(self, cursor, table_name):
288288
WHERE
289289
kc.table_schema = SCHEMA_NAME() AND
290290
kc.table_name = %s
291-
ORDER BY kc.ordinal_position ASC
291+
ORDER BY
292+
kc.constraint_name ASC,
293+
kc.ordinal_position ASC
292294
""", [table_name])
293295
for constraint, column, kind, ref_table, ref_column in cursor.fetchall():
294296
# If we're the first column, make the record

0 commit comments

Comments
 (0)