Loading django/core/management/commands/inspectdb.py +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class Command(NoArgsCommand): yield 'from %s import models' % self.db_module yield '' known_models = [] for table_name in connection.introspection.get_table_list(cursor): for table_name in connection.introspection.table_names(cursor): yield 'class %s(models.Model):' % table2model(table_name) known_models.append(table2model(table_name)) try: Loading django/core/management/sql.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ def sql_delete(app, style, connection): # Figure out which tables already exist if cursor: table_names = connection.introspection.get_table_list(cursor) table_names = connection.introspection.table_names(cursor) else: table_names = [] Loading django/db/backends/__init__.py +17 −4 Original line number Diff line number Diff line Loading @@ -898,10 +898,23 @@ class BaseDatabaseIntrospection(object): """ return name def table_names(self): "Returns a list of names of all tables that exist in the database." def table_names(self, cursor=None): """ Returns a list of names of all tables that exist in the database. The returned table list is sorted by Python's default sorting. We do NOT use database's ORDER BY here to avoid subtle differences in sorting order between databases. """ if cursor is None: cursor = self.connection.cursor() return self.get_table_list(cursor) return sorted(self.get_table_list(cursor)) def get_table_list(self, cursor): """ Returns an unsorted list of names of all tables that exist in the database. """ raise NotImplementedError def django_table_names(self, only_existing=False): """ Loading django/db/backends/mysql/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): """ cursor = self.cursor() if table_names is None: table_names = self.introspection.get_table_list(cursor) table_names = self.introspection.table_names(cursor) for table_name in table_names: primary_key_column_name = self.introspection.get_primary_key_column(cursor, table_name) if not primary_key_column_name: Loading django/db/backends/sqlite3/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -295,7 +295,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): """ cursor = self.cursor() if table_names is None: table_names = self.introspection.get_table_list(cursor) table_names = self.introspection.table_names(cursor) for table_name in table_names: primary_key_column_name = self.introspection.get_primary_key_column(cursor, table_name) if not primary_key_column_name: Loading Loading
django/core/management/commands/inspectdb.py +1 −1 Original line number Diff line number Diff line Loading @@ -42,7 +42,7 @@ class Command(NoArgsCommand): yield 'from %s import models' % self.db_module yield '' known_models = [] for table_name in connection.introspection.get_table_list(cursor): for table_name in connection.introspection.table_names(cursor): yield 'class %s(models.Model):' % table2model(table_name) known_models.append(table2model(table_name)) try: Loading
django/core/management/sql.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ def sql_delete(app, style, connection): # Figure out which tables already exist if cursor: table_names = connection.introspection.get_table_list(cursor) table_names = connection.introspection.table_names(cursor) else: table_names = [] Loading
django/db/backends/__init__.py +17 −4 Original line number Diff line number Diff line Loading @@ -898,10 +898,23 @@ class BaseDatabaseIntrospection(object): """ return name def table_names(self): "Returns a list of names of all tables that exist in the database." def table_names(self, cursor=None): """ Returns a list of names of all tables that exist in the database. The returned table list is sorted by Python's default sorting. We do NOT use database's ORDER BY here to avoid subtle differences in sorting order between databases. """ if cursor is None: cursor = self.connection.cursor() return self.get_table_list(cursor) return sorted(self.get_table_list(cursor)) def get_table_list(self, cursor): """ Returns an unsorted list of names of all tables that exist in the database. """ raise NotImplementedError def django_table_names(self, only_existing=False): """ Loading
django/db/backends/mysql/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -454,7 +454,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): """ cursor = self.cursor() if table_names is None: table_names = self.introspection.get_table_list(cursor) table_names = self.introspection.table_names(cursor) for table_name in table_names: primary_key_column_name = self.introspection.get_primary_key_column(cursor, table_name) if not primary_key_column_name: Loading
django/db/backends/sqlite3/base.py +1 −1 Original line number Diff line number Diff line Loading @@ -295,7 +295,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): """ cursor = self.cursor() if table_names is None: table_names = self.introspection.get_table_list(cursor) table_names = self.introspection.table_names(cursor) for table_name in table_names: primary_key_column_name = self.introspection.get_primary_key_column(cursor, table_name) if not primary_key_column_name: Loading