Bug #36405 mysqldump dumping data to CSV, aka --csv option
Submitted: 29 Apr 2008 16:22 Modified: 29 Apr 2008 16:25
Reporter: Geert Vanderkelen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S4 (Feature request)
Version:6.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: Backup, Contribution, csv, mysqldump

[29 Apr 2008 16:22] Geert Vanderkelen
Description:
Currently we support dumping to SQL, XML and using -T/--tab to CSV files too. The latter is however only dumping on the machine where the mysqld runs on, and the user doing the dump needs the FILE privileged. This ain't useful..

So, just like we have --xml for mysqldump, it would be nice having --csv which just dumps data to CSV files using the already available options for delimiting fields, lines, etc..

Changing the behavior of -T is no option as it's probably used (some people actually do make backups :)), and its usage is well documented.

How to repeat:
(this is a feature request)

Suggested fix:
Add --csv option to mysqldump:
 shell> mysqldump --csv /path/to/directory

Proposal:
* which will dump DDL to SQL files per database, maybe with the SQL statement already in there which reads the CSV files?
* make subdirectories for each database containing the CSV dumped data.

The options --fields-* are already available, so they can be reused.
[29 Apr 2008 16:25] Susanne Ebrecht
Verified as described.
[30 Apr 2008 15:02] Geert Vanderkelen
Patch implementing mysqldump --csv (6.0bk)

Attachment: mysqldump_csv.patch (, text), 17.08 KiB.

[30 Apr 2009 0:52] Jim Winstead
I wonder if it would make just as much sense to add a --local option to be used in conjunction with --tsv to write the TSV-formatted files locally.

The patch doesn't really format CSV correctly -- it will use \ for escaping field values.