Revision 4439
Added by Aaron Marcuse-Kubitza over 12 years ago
csv2db | ||
---|---|---|
51 | 51 |
|
52 | 52 |
table = sql_gen.Table(table, schema) |
53 | 53 |
|
54 |
log('Creating errors table') |
|
55 |
errors_table = sql_io.errors_table(db, table, if_exists=False) |
|
56 |
if errors_table_only: sql.drop_table(db, errors_table) |
|
57 |
typed_cols = [ |
|
58 |
sql_gen.TypedCol('column', 'text', nullable=False), |
|
59 |
sql_gen.TypedCol('value', 'text'), |
|
60 |
sql_gen.TypedCol('error_code', 'character varying(5)', |
|
61 |
nullable=False), |
|
62 |
sql_gen.TypedCol('error', 'text', nullable=False), |
|
63 |
] |
|
64 |
sql.create_table(db, errors_table, typed_cols, has_pkey=False) |
|
65 |
index_cols = ['column', 'value', 'error_code', 'error'] |
|
66 |
sql.add_index(db, index_cols, errors_table, unique=True) |
|
67 |
|
|
68 | 54 |
use_copy_from = [True] |
69 | 55 |
|
70 | 56 |
# Loads data into the table using the currently-selected approach. |
Also available in: Unified diff
csv2db: Removed no longer needed creation of errors table, because it is now created automatically by column-based import