diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-09-20 21:34:23 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-09-23 20:13:31 +0200 |
| commit | b8cdc7dcc3fc6897fb2a75f90023f5c67aad327f (patch) | |
| tree | 1ada75c3ada22e40d3fe8665fd93bbe103dffbf5 /django/db/backends/sqlite3 | |
| parent | 463952d94014ac2ea70a96828ddbf1330b504fc7 (diff) | |
Made get_table_list return a TableInfo named tuple
Diffstat (limited to 'django/db/backends/sqlite3')
| -rw-r--r-- | django/db/backends/sqlite3/introspection.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/django/db/backends/sqlite3/introspection.py b/django/db/backends/sqlite3/introspection.py index 0d7c36a40c..eb80b32c8b 100644 --- a/django/db/backends/sqlite3/introspection.py +++ b/django/db/backends/sqlite3/introspection.py @@ -1,6 +1,6 @@ import re -from django.db.backends import BaseDatabaseIntrospection, FieldInfo +from django.db.backends import BaseDatabaseIntrospection, FieldInfo, TableInfo field_size_re = re.compile(r'^\s*(?:var)?char\s*\(\s*(\d+)\s*\)\s*$') @@ -54,14 +54,16 @@ class DatabaseIntrospection(BaseDatabaseIntrospection): data_types_reverse = FlexibleFieldLookupDict() def get_table_list(self, cursor): - "Returns a list of table names in the current database." + """ + Returns a list of table and view names in the current database. + """ # Skip the sqlite_sequence system table used for autoincrement key # generation. cursor.execute(""" - SELECT name FROM sqlite_master + SELECT name, type FROM sqlite_master WHERE type in ('table', 'view') AND NOT name='sqlite_sequence' ORDER BY name""") - return [row[0] for row in cursor.fetchall()] + return [TableInfo(row[0], row[1][0]) 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." |
