Fixed primary key reflection for SA 0.5.

This commit is contained in:
Lance Edgar 2010-05-21 19:50:23 -05:00
parent 617c28e8c7
commit c2ba733f0d

View file

@ -61,6 +61,9 @@ class SQLBase7Dialect_SA05(SQLBase7Dialect):
cursor.close() cursor.close()
cursor = connection.connection.cursor() cursor = connection.connection.cursor()
for row in cursor.execute("SELECT COLNAME FROM %s.SYSPKCONSTRAINTS WHERE NAME = '%s' ORDER BY PKCOLSEQNUM" % (table.schema, table.name)): key_columns = [row.COLNAME for row in cursor.execute(
table.append_constraint(PrimaryKeyConstraint(row.COLNAME)) "SELECT COLNAME FROM %s.SYSPKCONSTRAINTS WHERE NAME = '%s' ORDER BY PKCOLSEQNUM" % (table.schema, table.name)
)]
if key_columns:
table.append_constraint(PrimaryKeyConstraint(*key_columns))
cursor.close() cursor.close()