Here's one way to get Python's csv module and mysqlimport to play nicely with one another.
When exporting something with the csv module, use:
When exporting something with the csv module, use:
csv.writer(fileobj, dialect='excel-tab', lineterminator='\n')When importing with mysqlimport, use:
mysqlimport \In particular, the "--fields-escaped-by=''" took me a while to figure out. Hence, the csv module and mysqlimport will agree that '"' is escaped via '""' rather than '\"'.
--user=USERNAME \
--password \
--columns=COLUMNS \
--compress \
--fields-optionally-enclosed-by='"' \
--fields-terminated-by='\t' \
--fields-escaped-by='' \
--lines-terminated-by='\n' \
--local \
--lock-tables \
--verbose \
DATABASE INPUT.tsv
Comments
Right you are.
Glad I could help!