Mike Bayer  committed d5b1638

- added a Sequence to the unicode test tables to help Oracle
- fixed named PrimaryKeyConstraint generation on oracle [ticket:466] courtesy andrija at gmail

  • Participants
  • Parent commits 16ba50c
  • Branches default

Comments (0)

Files changed (4)

   - sequences on a non-pk column will properly fire off on INSERT
   - added PrefetchingResultProxy support to pre-fetch LOB columns when they are 
   known to be present, fixes [ticket:435]
+  - fixed named PrimaryKeyConstraint generation [ticket:466] courtesy andrija at gmail
 - mysql:
   - fix to reflection on older DB's that might return array() type for 
   "show variables like" statements

File lib/sqlalchemy/databases/

             self.append("CREATE SEQUENCE %s" % self.preparer.format_sequence(sequence))
+    def visit_primary_key_constraint(self, constraint):
+        if len(constraint) == 0:
+            return
+        self.append(", \n\t")
+        if is not None:
+            self.append("CONSTRAINT %s " %
+        self.append("PRIMARY KEY ")
+        self.append("(%s)" % (string.join([self.preparer.format_column(c) for c in constraint],', ')))
 class OracleSchemaDropper(ansisql.ANSISchemaDropper):
     def visit_sequence(self, sequence):
         if self.engine.dialect.has_sequence(self.connection,

File test/orm/

         global metadata, uni_table, uni_table2
         metadata = BoundMetaData(testbase.db)
         uni_table = Table('uni_test', metadata,
-            Column('id',  Integer, primary_key=True),
+            Column('id',  Integer, Sequence("uni_test_id_seq", optional=True), primary_key=True),
             Column('txt', Unicode(50), unique=True))
         uni_table2 = Table('uni2', metadata,
-            Column('id',  Integer, primary_key=True),
+            Column('id',  Integer, Sequence("uni2_test_id_seq", optional=True), primary_key=True),
             Column('txt', Unicode(50), ForeignKey(uni_table.c.txt)))
     def tearDownAll(self):

File test/sql/

             Column('stuff', String(30)),
             Column('emp_id', Integer),
             Column('emp_soc', String(40)),
-            PrimaryKeyConstraint('id'),
+            PrimaryKeyConstraint('id', name='elements_primkey'),
             ForeignKeyConstraint(['emp_id', 'emp_soc'], ['', 'employees.soc'])