summaryrefslogtreecommitdiff
path: root/django/db/backends/mysql/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/mysql/introspection.py
parent463952d94014ac2ea70a96828ddbf1330b504fc7 (diff)
downloaddjango-b8cdc7dcc3fc6897fb2a75f90023f5c67aad327f.tar.gz
Made get_table_list return a TableInfo named tuple
Diffstat (limited to 'django/db/backends/mysql/introspection.py')
-rw-r--r--django/db/backends/mysql/introspection.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/django/db/backends/mysql/introspection.py b/django/db/backends/mysql/introspection.py
index 9b1a9a319b..8b7ff3c1e5 100644
--- a/django/db/backends/mysql/introspection.py
+++ b/django/db/backends/mysql/introspection.py
@@ -1,7 +1,7 @@
import re
from .base import FIELD_TYPE
from django.utils.datastructures import OrderedSet
-from django.db.backends import BaseDatabaseIntrospection, FieldInfo
+from django.db.backends import BaseDatabaseIntrospection, FieldInfo, TableInfo
from django.utils.encoding import force_text
@@ -33,9 +33,12 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
}
def get_table_list(self, cursor):
- "Returns a list of table names in the current database."
- cursor.execute("SHOW TABLES")
- return [row[0] for row in cursor.fetchall()]
+ """
+ Returns a list of table and view names in the current database.
+ """
+ cursor.execute("SHOW FULL TABLES")
+ return [TableInfo(row[0], {'BASE TABLE': 't', 'VIEW': 'v'}.get(row[1]))
+ for row in cursor.fetchall()]
def get_table_description(self, cursor, table_name):
"""