From 3fcdad5d0baed2f75577afcf7c08996ad02b8c1c Mon Sep 17 00:00:00 2001 From: Steven Buehler Date: Wed, 2 Sep 2015 15:58:47 -0400 Subject: [PATCH] Update empty-field handling in mysqldump_to_csv.py Made a change to the `if` that handles empty or 'NULL' field values so that it returns an empty field rather than `""`, which will get imported as `""` and not as an empty value. --- mysqldump_to_csv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysqldump_to_csv.py b/mysqldump_to_csv.py index 491cb36..32cb712 100644 --- a/mysqldump_to_csv.py +++ b/mysqldump_to_csv.py @@ -50,8 +50,8 @@ def parse_values(values, outfile): for reader_row in reader: for column in reader_row: # If our current string is empty... - if len(column) == 0: - latest_row.append('""') + if len(column) == 0 or column == 'NULL': + latest_row.append(chr(0)) continue # If our string starts with an open paren if column[0] == "(":