Revision 2720
Added by Aaron Marcuse-Kubitza over 12 years ago
csv2db | ||
---|---|---|
122 | 122 |
|
123 | 123 |
log('Creating errors table') |
124 | 124 |
errors_table = table+'.errors' |
125 |
typed_cols = [sql_gen.TypedCol('column', 'text NOT NULL'), |
|
125 |
typed_cols = [ |
|
126 |
sql_gen.TypedCol('column', 'text NOT NULL'), |
|
126 | 127 |
sql_gen.TypedCol('value', 'text'), |
127 |
sql_gen.TypedCol('error', 'text NOT NULL')] |
|
128 |
sql_gen.TypedCol('error_code', 'character varying(5) NOT NULL'), |
|
129 |
sql_gen.TypedCol('error', 'text NOT NULL'), |
|
130 |
] |
|
128 | 131 |
sql.create_table(db, errors_table, typed_cols, has_pkey=False) |
129 |
index_cols = ['column', sql_gen.EnsureNotNull('value'), 'error'] |
|
132 |
index_cols = ['column', sql_gen.EnsureNotNull('value'), 'error_code', |
|
133 |
'error'] |
|
130 | 134 |
sql.add_index(db, index_cols, errors_table, unique=True) |
131 | 135 |
db.db.commit() |
132 | 136 |
|
Also available in: Unified diff
sql.py: cast(): Made errors table also store SQLSTATE in error_code column