diff options
author | Michael Trier <mtrier@gmail.com> | 2008-12-28 17:38:26 +0000 |
---|---|---|
committer | Michael Trier <mtrier@gmail.com> | 2008-12-28 17:38:26 +0000 |
commit | a848e2ac4719ef8c1fdedd8ee1dd57daa18969b2 (patch) | |
tree | 70988c7dd0673e9b57dc8a4a9d83364b012f74db /lib/sqlalchemy/databases | |
parent | cae83f6d4fc3eef57814e6bd554bc39461644359 (diff) | |
download | sqlalchemy-a848e2ac4719ef8c1fdedd8ee1dd57daa18969b2.tar.gz |
Corrected reflection issue in mssql where include_columns doesn't include the PK.
Diffstat (limited to 'lib/sqlalchemy/databases')
-rw-r--r-- | lib/sqlalchemy/databases/mssql.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/databases/mssql.py b/lib/sqlalchemy/databases/mssql.py index 61f54a8ba..0844745de 100644 --- a/lib/sqlalchemy/databases/mssql.py +++ b/lib/sqlalchemy/databases/mssql.py @@ -1096,7 +1096,7 @@ class MSSQLDialect(default.DefaultDialect): if row is None: break col_name, type_name = row[3], row[5] - if type_name.endswith("identity"): + if type_name.endswith("identity") and col_name in table.c: ic = table.c[col_name] ic.autoincrement = True # setup a psuedo-sequence to represent the identity attribute - we interpret this at table.create() time as the identity attribute @@ -1128,7 +1128,7 @@ class MSSQLDialect(default.DefaultDialect): C.c.table_schema == (table.schema or current_schema))) c = connection.execute(s) for row in c: - if 'PRIMARY' in row[TC.c.constraint_type.name]: + if 'PRIMARY' in row[TC.c.constraint_type.name] and row[0] in table.c: table.primary_key.add(table.c[row[0]]) # Foreign key constraints |