Django

Code

Changeset 5963

Show
Ignore:
Timestamp:
08/19/07 19:15:53 (1 year ago)
Author:
adrian
Message:

Refactored get_sql_flush() to DatabaseOperations?.sql_flush(). Refs #5106

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/core/management/sql.py

    r5960 r5963  
    179179 
    180180def sql_flush(style): 
    181     "Returns a list of the SQL statements used to flush the database
    182     from django.db import backend 
    183     statements = backend.get_sql_flush(style, table_list(), sequence_list()) 
     181    "Returns a list of the SQL statements used to flush the database.
     182    from django.db import connection 
     183    statements = connection.ops.sql_flush(style, table_list(), sequence_list()) 
    184184    return statements 
    185185 
  • django/trunk/django/db/backends/ado_mssql/base.py

    r5962 r5963  
    110110    return "ON %s" % quote_name(tablespace) 
    111111 
    112 def get_sql_flush(style, tables, sequences): 
    113     """Return a list of SQL statements required to remove all data from 
    114     all tables in the database (without actually removing the tables 
    115     themselves) and put the database in an empty 'initial' state 
    116     """ 
    117     # Return a list of 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements 
    118     # TODO - SQL not actually tested against ADO MSSQL yet! 
    119     # TODO - autoincrement indices reset required? See other get_sql_flush() implementations 
    120     sql_list = ['%s %s;' % \ 
    121                 (style.SQL_KEYWORD('TRUNCATE'), 
    122                  style.SQL_FIELD(quote_name(table)) 
    123                  )  for table in tables] 
    124  
    125112def get_sql_sequence_reset(style, model_list): 
    126113    "Returns a list of the SQL statements to reset sequences for the given models." 
  • django/trunk/django/db/backends/dummy/base.py

    r5962 r5963  
    4545dictfetchall = complain 
    4646get_start_transaction_sql = complain 
    47 get_sql_flush = complain 
    4847get_sql_sequence_reset = complain 
    4948 
  • django/trunk/django/db/backends/__init__.py

    r5962 r5963  
    140140        """ 
    141141        return 'RANDOM()' 
     142 
     143    def sql_flush(self, style, tables, sequences): 
     144        """ 
     145        Returns a list of SQL statements required to remove all data from 
     146        the given database tables (without actually removing the tables 
     147        themselves). 
     148 
     149        The `style` argument is a Style object as returned by either 
     150        color_style() or no_style() in django.core.management.color. 
     151        """ 
     152        raise NotImplementedError() 
  • django/trunk/django/db/backends/mysql/base.py

    r5962 r5963  
    8787    def random_function_sql(self): 
    8888        return 'RAND()' 
     89 
     90    def sql_flush(self, style, tables, sequences): 
     91        # NB: The generated SQL below is specific to MySQL 
     92        # 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements 
     93        # to clear all tables of all data 
     94        if tables: 
     95            sql = ['SET FOREIGN_KEY_CHECKS = 0;'] 
     96            for table in tables: 
     97                sql.append('%s %s;' % (style.SQL_KEYWORD('TRUNCATE'), style.SQL_FIELD(quote_name(table)))) 
     98            sql.append('SET FOREIGN_KEY_CHECKS = 1;') 
     99 
     100            # 'ALTER TABLE table AUTO_INCREMENT = 1;'... style SQL statements 
     101            # to reset sequence indices 
     102            sql.extend(["%s %s %s %s %s;" % \ 
     103                (style.SQL_KEYWORD('ALTER'), 
     104                 style.SQL_KEYWORD('TABLE'), 
     105                 style.SQL_TABLE(quote_name(sequence['table'])), 
     106                 style.SQL_KEYWORD('AUTO_INCREMENT'), 
     107                 style.SQL_FIELD('= 1'), 
     108                ) for sequence in sequences]) 
     109            return sql 
     110        else: 
     111            return [] 
    89112 
    90113class DatabaseWrapper(BaseDatabaseWrapper): 
     
    169192    return "BEGIN;" 
    170193 
    171 def get_sql_flush(style, tables, sequences): 
    172     """Return a list of SQL statements required to remove all data from 
    173     all tables in the database (without actually removing the tables 
    174     themselves) and put the database in an empty 'initial' state 
    175  
    176     """ 
    177     # NB: The generated SQL below is specific to MySQL 
    178     # 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements 
    179     # to clear all tables of all data 
    180     if tables: 
    181         sql = ['SET FOREIGN_KEY_CHECKS = 0;'] + \ 
    182               ['%s %s;' % \ 
    183                 (style.SQL_KEYWORD('TRUNCATE'), 
    184                  style.SQL_FIELD(quote_name(table)) 
    185                 )  for table in tables] + \ 
    186               ['SET FOREIGN_KEY_CHECKS = 1;'] 
    187  
    188         # 'ALTER TABLE table AUTO_INCREMENT = 1;'... style SQL statements 
    189         # to reset sequence indices 
    190         sql.extend(["%s %s %s %s %s;" % \ 
    191             (style.SQL_KEYWORD('ALTER'), 
    192              style.SQL_KEYWORD('TABLE'), 
    193              style.SQL_TABLE(quote_name(sequence['table'])), 
    194              style.SQL_KEYWORD('AUTO_INCREMENT'), 
    195              style.SQL_FIELD('= 1'), 
    196             ) for sequence in sequences]) 
    197         return sql 
    198     else: 
    199         return [] 
    200  
    201194def get_sql_sequence_reset(style, model_list): 
    202195    "Returns a list of the SQL statements to reset sequences for the given models." 
  • django/trunk/django/db/backends/mysql_old/base.py

    r5962 r5963  
    9797    def random_function_sql(self): 
    9898        return 'RAND()' 
     99 
     100    def sql_flush(self, style, tables, sequences): 
     101        # NB: The generated SQL below is specific to MySQL 
     102        # 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements 
     103        # to clear all tables of all data 
     104        if tables: 
     105            sql = ['SET FOREIGN_KEY_CHECKS = 0;'] 
     106            for table in tables: 
     107                sql.append('%s %s;' % (style.SQL_KEYWORD('TRUNCATE'), style.SQL_FIELD(quote_name(table)))) 
     108            sql.append('SET FOREIGN_KEY_CHECKS = 1;') 
     109 
     110            # 'ALTER TABLE table AUTO_INCREMENT = 1;'... style SQL statements 
     111            # to reset sequence indices 
     112            sql.extend(["%s %s %s %s %s;" % \ 
     113                (style.SQL_KEYWORD('ALTER'), 
     114                 style.SQL_KEYWORD('TABLE'), 
     115                 style.SQL_TABLE(quote_name(sequence['table'])), 
     116                 style.SQL_KEYWORD('AUTO_INCREMENT'), 
     117                 style.SQL_FIELD('= 1'), 
     118                ) for sequence in sequences]) 
     119            return sql 
     120        else: 
     121            return [] 
    99122 
    100123class DatabaseWrapper(BaseDatabaseWrapper): 
     
    188211    return "BEGIN;" 
    189212 
    190 def get_sql_flush(style, tables, sequences): 
    191     """Return a list of SQL statements required to remove all data from 
    192     all tables in the database (without actually removing the tables 
    193     themselves) and put the database in an empty 'initial' state 
    194  
    195     """ 
    196     # NB: The generated SQL below is specific to MySQL 
    197     # 'TRUNCATE x;', 'TRUNCATE y;', 'TRUNCATE z;'... style SQL statements 
    198     # to clear all tables of all data 
    199     if tables: 
    200         sql = ['SET FOREIGN_KEY_CHECKS = 0;'] + \ 
    201               ['%s %s;' % \ 
    202                 (style.SQL_KEYWORD('TRUNCATE'), 
    203                  style.SQL_FIELD(quote_name(table)) 
    204                 )  for table in tables] + \ 
    205               ['SET FOREIGN_KEY_CHECKS = 1;'] 
    206  
    207         # 'ALTER TABLE table AUTO_INCREMENT = 1;'... style SQL statements 
    208         # to reset sequence indices 
    209         sql.extend(["%s %s %s %s %s;" % \ 
    210             (style.SQL_KEYWORD('ALTER'), 
    211              style.SQL_KEYWORD('TABLE'), 
    212              style.SQL_TABLE(quote_name(sequence['table'])), 
    213              style.SQL_KEYWORD('AUTO_INCREMENT'), 
    214              style.SQL_FIELD('= 1'), 
    215             ) for sequence in sequences]) 
    216         return sql 
    217     else: 
    218         return [] 
    219  
    220213def get_sql_sequence_reset(style, model_list): 
    221214    "Returns a list of the SQL statements to reset sequences for the given models." 
  • django/trunk/django/db/backends/oracle/base.py

    r5962 r5963  
    7373    def random_function_sql(self): 
    7474        return "DBMS_RANDOM.RANDOM" 
     75 
     76    def sql_flush(self, style, tables, sequences): 
     77        # Return a list of 'TRUNCATE x;', 'TRUNCATE y;', 
     78        # 'TRUNCATE z;'... style SQL statements 
     79        if tables: 
     80            # Oracle does support TRUNCATE, but it seems to get us into 
     81            # FK referential trouble, whereas DELETE FROM table works. 
     82            sql = ['%s %s %s;' % \ 
     83                    (style.SQL_KEYWORD('DELETE'), 
     84                     style.SQL_KEYWORD('FROM'), 
     85                     style.SQL_FIELD(quote_name(table)) 
     86                     ) for table in tables] 
     87            # Since we've just deleted all the rows, running our sequence 
     88            # ALTER code will reset the sequence to 0. 
     89            for sequence_info in sequences: 
     90                table_name = sequence_info['table'] 
     91                seq_name = get_sequence_name(table_name) 
     92                query = _get_sequence_reset_sql() % {'sequence':seq_name, 'table':quote_name(table_name)} 
     93                sql.append(query) 
     94            return sql 
     95        else: 
     96            return [] 
    7597 
    7698class DatabaseWrapper(BaseDatabaseWrapper): 
     
    218240        END; 
    219241        /""" 
    220  
    221 def get_sql_flush(style, tables, sequences): 
    222     """Return a list of SQL statements required to remove all data from 
    223     all tables in the database (without actually removing the tables 
    224     themselves) and put the database in an empty 'initial' state 
    225     """ 
    226     # Return a list of 'TRUNCATE x;', 'TRUNCATE y;', 
    227     # 'TRUNCATE z;'... style SQL statements 
    228     if tables: 
    229         # Oracle does support TRUNCATE, but it seems to get us into 
    230         # FK referential trouble, whereas DELETE FROM table works. 
    231         sql = ['%s %s %s;' % \ 
    232                 (style.SQL_KEYWORD('DELETE'), 
    233                  style.SQL_KEYWORD('FROM'), 
    234                  style.SQL_FIELD(quote_name(table)) 
    235                  ) for table in tables] 
    236         # Since we've just deleted all the rows, running our sequence 
    237         # ALTER code will reset the sequence to 0. 
    238         for sequence_info in sequences: 
    239             table_name = sequence_info['table'] 
    240             seq_name = get_sequence_name(table_name) 
    241             query = _get_sequence_reset_sql() % {'sequence':seq_name, 
    242                                                  'table':quote_name(table_name)} 
    243             sql.append(query) 
    244         return sql 
    245     else: 
    246         return [] 
    247242 
    248243def get_sequence_name(table): 
  • django/trunk/django/db/backends/postgresql/base.py

    r5962 r5963  
    7373        cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name)) 
    7474        return cursor.fetchone()[0] 
     75 
     76    def sql_flush(self, style, tables, sequences): 
     77        if tables: 
     78            if postgres_version[0] >= 8 and postgres_version[1] >= 1: 
     79                # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to* 
     80                # in order to be able to truncate tables referenced by a foreign 
     81                # key in any other table. The result is a single SQL TRUNCATE 
     82                # statement. 
     83                sql = ['%s %s;' % \ 
     84                    (style.SQL_KEYWORD('TRUNCATE'), 
     85                     style.SQL_FIELD(', '.join([quote_name(table) for table in tables])) 
     86                )] 
     87            else: 
     88                # Older versions of Postgres can't do TRUNCATE in a single call, so 
     89                # they must use a simple delete. 
     90                sql = ['%s %s %s;' % \ 
     91                        (style.SQL_KEYWORD('DELETE'), 
     92                         style.SQL_KEYWORD('FROM'), 
     93                         style.SQL_FIELD(quote_name(table)) 
     94                         ) for table in tables] 
     95 
     96            # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements 
     97            # to reset sequence indices 
     98            for sequence_info in sequences: 
     99                table_name = sequence_info['table'] 
     100                column_name = sequence_info['column'] 
     101                if column_name and len(column_name)>0: 
     102                    # sequence name in this case will be <table>_<column>_seq 
     103                    sql.append("%s %s %s %s %s %s;" % \ 
     104                        (style.SQL_KEYWORD('ALTER'), 
     105                        style.SQL_KEYWORD('SEQUENCE'), 
     106                        style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), 
     107                        style.SQL_KEYWORD('RESTART'), 
     108                        style.SQL_KEYWORD('WITH'), 
     109                        style.SQL_FIELD('1') 
     110                        ) 
     111                    ) 
     112                else: 
     113                    # sequence name in this case will be <table>_id_seq 
     114                    sql.append("%s %s %s %s %s %s;" % \ 
     115                        (style.SQL_KEYWORD('ALTER'), 
     116                         style.SQL_KEYWORD('SEQUENCE'), 
     117                         style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), 
     118                         style.SQL_KEYWORD('RESTART'), 
     119                         style.SQL_KEYWORD('WITH'), 
     120                         style.SQL_FIELD('1') 
     121                         ) 
     122                    ) 
     123            return sql 
     124        else: 
     125            return [] 
    75126 
    76127class DatabaseWrapper(BaseDatabaseWrapper): 
     
    134185def get_start_transaction_sql(): 
    135186    return "BEGIN;" 
    136  
    137 def get_sql_flush(style, tables, sequences): 
    138     """Return a list of SQL statements required to remove all data from 
    139     all tables in the database (without actually removing the tables 
    140     themselves) and put the database in an empty 'initial' state 
    141  
    142     """ 
    143     if tables: 
    144         if postgres_version[0] >= 8 and postgres_version[1] >= 1: 
    145             # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to* 
    146             # in order to be able to truncate tables referenced by a foreign 
    147             # key in any other table. The result is a single SQL TRUNCATE 
    148             # statement. 
    149             sql = ['%s %s;' % \ 
    150                 (style.SQL_KEYWORD('TRUNCATE'), 
    151                  style.SQL_FIELD(', '.join([quote_name(table) for table in tables])) 
    152             )] 
    153         else: 
    154             # Older versions of Postgres can't do TRUNCATE in a single call, so 
    155             # they must use a simple delete. 
    156             sql = ['%s %s %s;' % \ 
    157                     (style.SQL_KEYWORD('DELETE'), 
    158                      style.SQL_KEYWORD('FROM'), 
    159                      style.SQL_FIELD(quote_name(table)) 
    160                      ) for table in tables] 
    161  
    162         # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements 
    163         # to reset sequence indices 
    164         for sequence_info in sequences: 
    165             table_name = sequence_info['table'] 
    166             column_name = sequence_info['column'] 
    167             if column_name and len(column_name)>0: 
    168                 # sequence name in this case will be <table>_<column>_seq 
    169                 sql.append("%s %s %s %s %s %s;" % \ 
    170                     (style.SQL_KEYWORD('ALTER'), 
    171                     style.SQL_KEYWORD('SEQUENCE'), 
    172                     style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), 
    173                     style.SQL_KEYWORD('RESTART'), 
    174                     style.SQL_KEYWORD('WITH'), 
    175                     style.SQL_FIELD('1') 
    176                     ) 
    177                 ) 
    178             else: 
    179                 # sequence name in this case will be <table>_id_seq 
    180                 sql.append("%s %s %s %s %s %s;" % \ 
    181                     (style.SQL_KEYWORD('ALTER'), 
    182                      style.SQL_KEYWORD('SEQUENCE'), 
    183                      style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), 
    184                      style.SQL_KEYWORD('RESTART'), 
    185                      style.SQL_KEYWORD('WITH'), 
    186                      style.SQL_FIELD('1') 
    187                      ) 
    188                 ) 
    189         return sql 
    190     else: 
    191         return [] 
    192187 
    193188def get_sql_sequence_reset(style, model_list): 
  • django/trunk/django/db/backends/postgresql_psycopg2/base.py

    r5962 r5963  
    3535        cursor.execute("SELECT CURRVAL('\"%s_%s_seq\"')" % (table_name, pk_name)) 
    3636        return cursor.fetchone()[0] 
     37 
     38    def sql_flush(self, style, tables, sequences): 
     39        if tables: 
     40            if postgres_version[0] >= 8 and postgres_version[1] >= 1: 
     41                # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to* 
     42                # in order to be able to truncate tables referenced by a foreign 
     43                # key in any other table. The result is a single SQL TRUNCATE 
     44                # statement. 
     45                sql = ['%s %s;' % \ 
     46                    (style.SQL_KEYWORD('TRUNCATE'), 
     47                     style.SQL_FIELD(', '.join([quote_name(table) for table in tables])) 
     48                )] 
     49            else: 
     50                # Older versions of Postgres can't do TRUNCATE in a single call, so 
     51                # they must use a simple delete. 
     52                sql = ['%s %s %s;' % \ 
     53                        (style.SQL_KEYWORD('DELETE'), 
     54                         style.SQL_KEYWORD('FROM'), 
     55                         style.SQL_FIELD(quote_name(table)) 
     56                         ) for table in tables] 
     57 
     58            # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements 
     59            # to reset sequence indices 
     60            for sequence_info in sequences: 
     61                table_name = sequence_info['table'] 
     62                column_name = sequence_info['column'] 
     63                if column_name and len(column_name)>0: 
     64                    # sequence name in this case will be <table>_<column>_seq 
     65                    sql.append("%s %s %s %s %s %s;" % \ 
     66                        (style.SQL_KEYWORD('ALTER'), 
     67                        style.SQL_KEYWORD('SEQUENCE'), 
     68                        style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), 
     69                        style.SQL_KEYWORD('RESTART'), 
     70                        style.SQL_KEYWORD('WITH'), 
     71                        style.SQL_FIELD('1') 
     72                        ) 
     73                    ) 
     74                else: 
     75                    # sequence name in this case will be <table>_id_seq 
     76                    sql.append("%s %s %s %s %s %s;" % \ 
     77                        (style.SQL_KEYWORD('ALTER'), 
     78                         style.SQL_KEYWORD('SEQUENCE'), 
     79                         style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), 
     80                         style.SQL_KEYWORD('RESTART'), 
     81                         style.SQL_KEYWORD('WITH'), 
     82                         style.SQL_FIELD('1') 
     83                         ) 
     84                    ) 
     85            return sql 
     86        else: 
     87            return [] 
    3788 
    3889class DatabaseWrapper(BaseDatabaseWrapper): 
     
    89140    return "BEGIN;" 
    90141 
    91 def get_sql_flush(style, tables, sequences): 
    92     """Return a list of SQL statements required to remove all data from 
    93     all tables in the database (without actually removing the tables 
    94     themselves) and put the database in an empty 'initial' state 
    95     """ 
    96     if tables: 
    97         if postgres_version[0] >= 8 and postgres_version[1] >= 1: 
    98             # Postgres 8.1+ can do 'TRUNCATE x, y, z...;'. In fact, it *has to* in order to be able to 
    99             # truncate tables referenced by a foreign key in any other table. The result is a 
    100             # single SQL TRUNCATE statement 
    101             sql = ['%s %s;' % \ 
    102                     (style.SQL_KEYWORD('TRUNCATE'), 
    103                      style.SQL_FIELD(', '.join([quote_name(table) for table in tables])) 
    104                     )] 
    105         else: 
    106             sql = ['%s %s %s;' % \ 
    107                     (style.SQL_KEYWORD('DELETE'), 
    108                      style.SQL_KEYWORD('FROM'), 
    109                      style.SQL_FIELD(quote_name(table)) 
    110                      ) for table in tables] 
    111  
    112         # 'ALTER SEQUENCE sequence_name RESTART WITH 1;'... style SQL statements 
    113         # to reset sequence indices 
    114         for sequence in sequences: 
    115             table_name = sequence['table'] 
    116             column_name = sequence['column'] 
    117             if column_name and len(column_name) > 0: 
    118                 # sequence name in this case will be <table>_<column>_seq 
    119                 sql.append("%s %s %s %s %s %s;" % \ 
    120                     (style.SQL_KEYWORD('ALTER'), 
    121                      style.SQL_KEYWORD('SEQUENCE'), 
    122                      style.SQL_FIELD(quote_name('%s_%s_seq' % (table_name, column_name))), 
    123                      style.SQL_KEYWORD('RESTART'), 
    124                      style.SQL_KEYWORD('WITH'), 
    125                      style.SQL_FIELD('1') 
    126                      ) 
    127                 ) 
    128             else: 
    129                 # sequence name in this case will be <table>_id_seq 
    130                 sql.append("%s %s %s %s %s %s;" % \ 
    131                     (style.SQL_KEYWORD('ALTER'), 
    132                      style.SQL_KEYWORD('SEQUENCE'), 
    133                      style.SQL_FIELD(quote_name('%s_id_seq' % table_name)), 
    134                      style.SQL_KEYWORD('RESTART'), 
    135                      style.SQL_KEYWORD('WITH'), 
    136                      style.SQL_FIELD('1') 
    137                      ) 
    138                 ) 
    139         return sql 
    140     else: 
    141         return [] 
    142  
    143142def get_sql_sequence_reset(style, model_list): 
    144143    "Returns a list of the SQL statements to reset sequences for the given models." 
  • django/trunk/django/db/backends/sqlite3/base.py

    r5962 r5963  
    5151    def pk_default_value(self): 
    5252        return 'NULL' 
     53 
     54    def sql_flush(self, style, tables, sequences): 
     55        # NB: The generated SQL below is specific to SQLite 
     56        # Note: The DELETE FROM... SQL generated below works for SQLite databases 
     57        # because constraints don't exist 
     58        sql = ['%s %s %s;' % \ 
     59                (style.SQL_KEYWORD('DELETE'), 
     60                 style.SQL_KEYWORD('FROM'), 
     61                 style.SQL_FIELD(quote_name(table)) 
     62                 ) for table in tables] 
     63        # Note: No requirement for reset of auto-incremented indices (cf. other 
     64        # sql_flush() implementations). Just return SQL at this point 
     65        return sql 
    5366 
    5467class DatabaseWrapper(BaseDatabaseWrapper): 
     
    122135    return "BEGIN;" 
    123136 
    124 def get_sql_flush(style, tables, sequences): 
    125     """ 
    126     Return a list of SQL statements required to remove all data from 
    127     all tables in the database (without actually removing the tables 
    128     themselves) and put the database in an empty 'initial' state 
    129     """ 
    130     # NB: The generated SQL below is specific to SQLite 
    131     # Note: The DELETE FROM... SQL generated below works for SQLite databases 
    132     # because constraints don't exist 
    133     sql = ['%s %s %s;' % \ 
    134             (style.SQL_KEYWORD('DELETE'), 
    135              style.SQL_KEYWORD('FROM'), 
    136              style.SQL_FIELD(quote_name(table)) 
    137              ) for table in tables] 
    138     # Note: No requirement for reset of auto-incremented indices (cf. other 
    139     # get_sql_flush() implementations). Just return SQL at this point 
    140     return sql 
    141  
    142137def get_sql_sequence_reset(style, model_list): 
    143138    "Returns a list of the SQL statements to reset sequences for the given models."