Author: Alex Date: 2010-10-30 19:53:58 -0500 (Sat, 30 Oct 2010) New Revision: 14402
Modified: django/trunk/django/core/management/commands/flush.py django/trunk/django/core/management/sql.py django/trunk/django/db/backends/__init__.py django/trunk/django/db/backends/sqlite3/introspection.py Log: When looking for django tables which exist, query for all tables once, not once *per table*. Modified: django/trunk/django/core/management/commands/flush.py =================================================================== --- django/trunk/django/core/management/commands/flush.py 2010-10-30 23:39:53 UTC (rev 14401) +++ django/trunk/django/core/management/commands/flush.py 2010-10-31 00:53:58 UTC (rev 14402) @@ -9,7 +9,6 @@ from django.utils.importlib import import_module - class Command(NoArgsCommand): option_list = NoArgsCommand.option_list + ( make_option('--noinput', action='store_false', dest='interactive', default=True, Modified: django/trunk/django/core/management/sql.py =================================================================== --- django/trunk/django/core/management/sql.py 2010-10-30 23:39:53 UTC (rev 14401) +++ django/trunk/django/core/management/sql.py 2010-10-31 00:53:58 UTC (rev 14402) @@ -111,7 +111,9 @@ tables = connection.introspection.django_table_names(only_existing=True) else: tables = connection.introspection.table_names() - statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list()) + statements = connection.ops.sql_flush( + style, tables, connection.introspection.sequence_list() + ) return statements def sql_custom(app, style, connection): Modified: django/trunk/django/db/backends/__init__.py =================================================================== --- django/trunk/django/db/backends/__init__.py 2010-10-30 23:39:53 UTC (rev 14401) +++ django/trunk/django/db/backends/__init__.py 2010-10-31 00:53:58 UTC (rev 14402) @@ -615,7 +615,12 @@ tables.add(model._meta.db_table) tables.update([f.m2m_db_table() for f in model._meta.local_many_to_many]) if only_existing: - tables = [t for t in tables if self.table_name_converter(t) in self.table_names()] + existing_tables = self.table_names() + tables = [ + t + for t in tables + if self.table_name_converter(t) in existing_tables + ] return tables def installed_models(self, tables): Modified: django/trunk/django/db/backends/sqlite3/introspection.py =================================================================== --- django/trunk/django/db/backends/sqlite3/introspection.py 2010-10-30 23:39:53 UTC (rev 14401) +++ django/trunk/django/db/backends/sqlite3/introspection.py 2010-10-31 00:53:58 UTC (rev 14402) @@ -4,7 +4,7 @@ # This light wrapper "fakes" a dictionary interface, because some SQLite data # types include variables in them -- e.g. "varchar(30)" -- and can't be matched # as a simple dictionary lookup. -class FlexibleFieldLookupDict: +class FlexibleFieldLookupDict(object): # Maps SQL types to Django Field types. Some of the SQL types have multiple # entries here because SQLite allows for anything and doesn't normalize the # field type; it uses whatever was given. @@ -138,4 +138,3 @@ 'null_ok': not field[3], 'pk': field[5] # undocumented } for field in cursor.fetchall()] - -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.