Revision 2693
Added by Aaron Marcuse-Kubitza over 12 years ago
bin/csv2db | ||
---|---|---|
126 | 126 |
sql_gen.TypedCol('value', 'text'), |
127 | 127 |
sql_gen.TypedCol('error', 'text NOT NULL')] |
128 | 128 |
sql.create_table(db, errors_table, typed_cols, has_pkey=False) |
129 |
ensure_not_null = sql_gen.Function('ensure_not_null', 'functions') |
|
130 |
index_cols = ['column', sql_gen.FunctionCall(ensure_not_null, |
|
131 |
sql_gen.Col('value')), 'error'] |
|
129 |
index_cols = ['column', sql_gen.EnsureNotNull(sql_gen.Col('value')), |
|
130 |
'error'] |
|
132 | 131 |
sql.add_index(db, index_cols, errors_table, unique=True) |
133 | 132 |
db.db.commit() |
134 | 133 |
|
Also available in: Unified diff
csv2db: Use sql_gen.EnsureNotNull instead of the ensure_not_null() function in the functions schema to avoid a dependency on the functions schema, which would cause the UNIQUE index to be dropped whenever the functions schema is reinstalled