]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix reflection where the table name has a duplicate name in a different schema
authorPaul Johnston <paj@pajhome.org.uk>
Tue, 15 Jul 2008 09:15:59 +0000 (09:15 +0000)
committerPaul Johnston <paj@pajhome.org.uk>
Tue, 15 Jul 2008 09:15:59 +0000 (09:15 +0000)
lib/sqlalchemy/databases/mssql.py

index 40c7903a88d89d7685bc063c9683bac98cce745b..ce9ca441e6b79076f01809bbbef4f490a7f87b3e 100644 (file)
@@ -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]: