My two cents in. (django version 1.9.7 + django GIS extension)
Following Andy and Mirek Simek suggestions I further modified:
added 'schemas' in your db config in settings.py
...
'oracle1': {
'ENGINE': 'django.contrib.gis.db.backends.oracle',
'NAME': 'dbname',
'USER': 'dbuser',
'PASSWORD': 'dbpass',
'HOST': 'dbhostname',
'PORT': 'dbport',
'schemas': ['SCHEMANAME1', ....] #<-- this
},
...
modified get_tables_list in this way:
def get_table_list(self, cursor):
"""
Returns a list of table and view names in the current database.
"""
cursor.execute("SELECT TABLE_NAME, 't' FROM USER_TABLES UNION ALL "
"SELECT VIEW_NAME, 'v' FROM USER_VIEWS")
res = [TableInfo(row[0].lower(), row[1]) for row in cursor.fetchall()]
schemas = self.connection.settings_dict.get('schemas')
if schemas and len(schemas)>0:
for s in schemas:
cursor.execute("SELECT TABLE_NAME, 't' FROM ALL_TABLES WHERE OWNER = '%s'" %s)
for row in cursor.fetchall():
tbl_name, typ = '.'.join([s,row[0].lower()]), row[1]
try:
# let us check for permission to query
cursor.execute("SELECT * FROM %s WHERE ROWNUM < 1" % tbl_name.upper())
except DatabaseError, e:
pass
else:
res.append(TableInfo(tbl_name, typ))
return res
Cause I'm using gis I had to make a dirty patch (I don't know if it is needed due to database issue) to django/contrib/gis/db/backends/oracle/introspection.py
just added this at the end of get_geometry_type
...
dim = len(dim)
if dim != 2:
field_params['dim'] = dim
except: # <-- this
pass # <-- this
finally:
cursor.close()
...