Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #20014 -- implemented get_key_columns() for Oracle

Thanks Aymeric Augustin for reporting
  • Loading branch information...
commit 0027f1390443f199087d0784920450d93a359614 1 parent 0268aba
@shaib shaib authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 django/db/backends/oracle/introspection.py
View
12 django/db/backends/oracle/introspection.py
@@ -90,6 +90,18 @@ def get_relations(self, cursor, table_name):
relations[row[0]] = (row[2], row[1].lower())
return relations
+ def get_key_columns(self, cursor, table_name):
+ cursor.execute("""
+ SELECT ccol.column_name, rcol.table_name AS referenced_table, rcol.column_name AS referenced_column
+ FROM user_constraints c
+ JOIN user_cons_columns ccol
+ ON ccol.constraint_name = c.constraint_name
+ JOIN user_cons_columns rcol
+ ON rcol.constraint_name = c.r_constraint_name
+ WHERE c.table_name = %s AND c.constraint_type = 'R'""" , [table_name.upper()])
+ return [tuple(cell.lower() for cell in row)
+ for row in cursor.fetchall()]
+
def get_indexes(self, cursor, table_name):
sql = """
SELECT LOWER(uic1.column_name) AS column_name,
Please sign in to comment.
Something went wrong with that request. Please try again.