From a856dc9217dc09fe9f0980cbc11ea387f2c17583 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 30 Sep 2012 18:24:51 -0400 Subject: [PATCH] - [bug] Fixed bug where reflection of primary key constraint would double up columns if the same constraint/table existed in multiple schemas. --- CHANGES | 4 ++++ lib/sqlalchemy/dialects/mssql/base.py | 1 + 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 9543c0a5fd..09e5d6f50b 100644 --- a/CHANGES +++ b/CHANGES @@ -205,6 +205,10 @@ CHANGES attribute, causing the construct to not compile correctly a second time. [ticket:2545] + - [bug] Fixed bug where reflection of primary key constraint + would double up columns if the same constraint/table + existed in multiple schemas. + 0.7.8 ===== - orm diff --git a/lib/sqlalchemy/dialects/mssql/base.py b/lib/sqlalchemy/dialects/mssql/base.py index c544d1d48e..e86715fc29 100644 --- a/lib/sqlalchemy/dialects/mssql/base.py +++ b/lib/sqlalchemy/dialects/mssql/base.py @@ -1454,6 +1454,7 @@ class MSDialect(default.DefaultDialect): # Primary key constraints s = sql.select([C.c.column_name, TC.c.constraint_type], sql.and_(TC.c.constraint_name == C.c.constraint_name, + TC.c.table_schema == C.c.table_schema, C.c.table_name == tablename, C.c.table_schema == current_schema) ) -- 2.47.2