Project

General

Profile

« Previous | Next » 

Revision 2876

csv2db: Use sql_gen.TypedCol.nullable instead of manually adding 'NOT NULL' to the type. Ensure that pkeys are properly NOT NULL.

View differences:

csv2db
63 63
        def esc_name(name): return sql.esc_name(db, name)
64 64
        sql.run_query(db, 'SET search_path TO '+esc_name(schema))
65 65
        
66
        typed_cols = [sql_gen.TypedCol('row_num', 'serial')]+[
66
        typed_cols = [sql_gen.TypedCol('row_num', 'serial', nullable=False)]+[
67 67
            sql_gen.TypedCol(v, 'text') for v in col_names]
68 68
        
69 69
        def load_():
......
124 124
        log('Creating errors table')
125 125
        errors_table = sql.errors_table(db, table, if_exists=False)
126 126
        typed_cols = [
127
            sql_gen.TypedCol('column', 'text NOT NULL'),
127
            sql_gen.TypedCol('column', 'text', nullable=False),
128 128
            sql_gen.TypedCol('value', 'text'),
129
            sql_gen.TypedCol('error_code', 'character varying(5) NOT NULL'),
130
            sql_gen.TypedCol('error', 'text NOT NULL'),
129
            sql_gen.TypedCol('error_code', 'character varying(5)',
130
                nullable=False),
131
            sql_gen.TypedCol('error', 'text', nullable=False),
131 132
            ]
132 133
        sql.create_table(db, errors_table, typed_cols, has_pkey=False)
133 134
        index_cols = ['column', 'value', 'error_code', 'error']

Also available in: Unified diff