Project

General

Profile

« Previous | Next » 

Revision 2760

sql.py: create_table(): Add indexes on all non-pkey columns, unless turned off or deferred using new param col_indexes

View differences:

csv2db
68 68
        
69 69
        def load_():
70 70
            log('Creating table')
71
            sql.create_table(db, table, typed_cols)
71
            sql.create_table(db, table, typed_cols, col_indexes=False)
72 72
            
73 73
            # Create COPY FROM statement
74 74
            if use_copy_from[0]:
......
130 130
            sql_gen.TypedCol('error', 'text NOT NULL'),
131 131
            ]
132 132
        sql.create_table(db, errors_table, typed_cols, has_pkey=False)
133
        for col in typed_cols: sql.add_index(db, col.to_Col(), errors_table)
134 133
        index_cols = ['column', sql_gen.EnsureNotNull('value'), 'error_code',
135 134
            'error']
136 135
        sql.add_index(db, index_cols, errors_table, unique=True)

Also available in: Unified diff