From b8cdc7dcc3fc6897fb2a75f90023f5c67aad327f Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sat, 20 Sep 2014 21:34:23 +0200 Subject: Made get_table_list return a TableInfo named tuple --- django/db/backends/oracle/introspection.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'django/db/backends/oracle/introspection.py') 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." -- cgit v1.2.1