Oracle reflection - unique key columns not set as primary keys

Issue #284 resolved
Former user created an issue
--- oracle.py~  2006-08-12 17:15:26.000000000 -0500
+++ oracle.py   2006-08-25 15:02:25.771760800 -0500
@@ -102,7 +102,7 @@
   all_cons_columns loc,
   all_cons_columns rem
 WHERE ac.table_name = :table_name
-AND ac.constraint_type IN ('R','P')
+AND ac.constraint_type IN ('R','P','U')
 AND ac.owner = :owner
 AND ac.owner = loc.owner
 AND ac.constraint_name = loc.constraint_name
@@ -243,7 +243,7 @@
                 break
             #print "ROW:" , row                
             (cons_name, cons_type, local_column, remote_table, remote_column) = row
-            if cons_type == 'P':
+            if cons_type in ('P','U'):
                 table.c[local_column](local_column)._set_primary_key()
             elif cons_type == 'R':
                 try:

Comments (6)

  1. Mike Bayer repo owner

    why would you want a UNIQUE constraint to be marked as a primary key ?

    there is a schema item called UniqueConstraint which hadnt been quite completed, but it builds on the same framework as the other constraints, and should probably be used for this.

  2. Former user Account Deleted

    I mapped a pre-exisitng table that had only unique keys and could do no joins to it. "Could not assemble any primary key columns for mapped table," so I gave it some :-)

    You are right, just disregard this until UniqueConstraint is ready.

  3. Log in to comment