From: Paul Johnston Date: Tue, 15 Jul 2008 09:15:59 +0000 (+0000) Subject: Fix reflection where the table name has a duplicate name in a different schema X-Git-Tag: rel_0_5beta3~56 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16e8d446866d5fc250fa287ea6881903661a00b0;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Fix reflection where the table name has a duplicate name in a different schema --- diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 40c7903a88..ce9ca441e6 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -638,7 +638,8 @@ class MSSQLDialect(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, - C.c.table_name == table.name)) + C.c.table_name == table.name, + C.c.table_schema == table.schema)) c = connection.execute(s) for row in c: if 'PRIMARY' in row[TC.c.constraint_type.name]: