Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #20386 - Introspection problem on Oracle

Made introspection always return a unicode as column name on Oracle.
Thanks aaugustin for review and suggestion to use force_text().
  • Loading branch information...
commit 215647c0f7614abe4fe0cd76bc70dd7b02f829b4 1 parent 3401152
Shai Berger authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/db/backends/oracle/introspection.py
4 django/db/backends/oracle/introspection.py
View
@@ -1,4 +1,5 @@
from django.db.backends import BaseDatabaseIntrospection, FieldInfo
+from django.utils.encoding import force_text
import cx_Oracle
import re
@@ -48,7 +49,8 @@ def get_table_description(self, cursor, table_name):
cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
description = []
for desc in cursor.description:
- description.append(FieldInfo(*((desc[0].lower(),) + desc[1:])))
+ name = force_text(desc[0]) # cx_Oracle always returns a 'str' on both Python 2 and 3
+ description.append(FieldInfo(*(name.lower(),) + desc[1:]))
return description
def table_name_converter(self, name):
Please sign in to comment.
Something went wrong with that request. Please try again.