Revision 2116
Added by Aaron Marcuse-Kubitza over 12 years ago
bin/csv2db | ||
---|---|---|
84 | 84 |
if dialect.doublequote: copy_from += ' ESCAPE %(quotechar)s' |
85 | 85 |
copy_from += ';\n' |
86 | 86 |
copy_from = cur.mogrify(copy_from, dict(delimiter=dialect.delimiter, |
87 |
null=r'\N', quotechar=dialect.quotechar))
|
|
87 |
null='', quotechar=dialect.quotechar))
|
|
88 | 88 |
if debug: sys.stderr.write(copy_from) |
89 | 89 |
|
90 | 90 |
# Load the data |
... | ... | |
105 | 105 |
finally: |
106 | 106 |
line_in.close() # also closes proc.stdout |
107 | 107 |
proc.wait() |
108 |
|
|
109 |
# Clean up the data |
|
110 |
sys.stderr.write('Cleaning up table\n') |
|
111 |
sql.cleanup_table(db, esc_table, cols, table_is_esc=True) |
|
108 | 112 |
load = lambda: sql.with_savepoint(db, load_) |
109 | 113 |
|
110 | 114 |
try: load() |
Also available in: Unified diff
csv2db: Use new sql.cleanup_table() to map NULL-equivalents to NULL. Consider the empty string to be NULL.