summaryrefslogtreecommitdiff
path: root/django/db/backends/oracle/introspection.py
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-09-20 21:34:23 +0200
committerClaude Paroz <claude@2xlibre.net>2014-09-23 20:13:31 +0200
commitb8cdc7dcc3fc6897fb2a75f90023f5c67aad327f (patch)
tree1ada75c3ada22e40d3fe8665fd93bbe103dffbf5 /django/db/backends/oracle/introspection.py
parent463952d94014ac2ea70a96828ddbf1330b504fc7 (diff)
downloaddjango-b8cdc7dcc3fc6897fb2a75f90023f5c67aad327f.tar.gz
Made get_table_list return a TableInfo named tuple
Diffstat (limited to 'django/db/backends/oracle/introspection.py')
-rw-r--r--django/db/backends/oracle/introspection.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/django/db/backends/oracle/introspection.py b/django/db/backends/oracle/introspection.py
index c89ceb0ebd..37ed7e1f00 100644
--- a/django/db/backends/oracle/introspection.py
+++ b/django/db/backends/oracle/introspection.py
@@ -2,7 +2,7 @@ import re
import cx_Oracle
-from django.db.backends import BaseDatabaseIntrospection, FieldInfo
+from django.db.backends import BaseDatabaseIntrospection, FieldInfo, TableInfo
from django.utils.encoding import force_text
foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")
@@ -48,9 +48,12 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
return super(DatabaseIntrospection, self).get_field_type(data_type, description)
def get_table_list(self, cursor):
- "Returns a list of table names in the current database."
- cursor.execute("SELECT TABLE_NAME FROM USER_TABLES")
- return [row[0].lower() for row in cursor.fetchall()]
+ """
+ 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")
+ return [TableInfo(row[0].lower(), row[1]) for row in cursor.fetchall()]
def get_table_description(self, cursor, table_name):
"Returns a description of the table, with the DB-API cursor.description interface."