Author jtalbot
Recipients jtalbot
Date 2009-05-08.22:31:08
SpamBayes Score 1.16224e-09
Marked as misclassified No
Message-id <1241821870.32.0.544896440632.issue5975@psf.upfronthosting.co.za>
In-reply-to
Content
I was having issues importing a csv file generated by the csv.write
class with the following:

load data infile 'file.csv' replace into table en fields terminated by
',' enclosed by '"' lines terminated by '\r\n';

To help prevent this from happening again, I would like to see the
following added to the csv.py library:

class unix_dialect(Dialect):
    """Describe the usual properties of unix-generated CSV files."""
    delimiter = ','
    quotechar = '"'
    doublequote = True
    skipinitialspace = False
    lineterminator = '\n'
    quoting = QUOTE_ALL
register_dialect("unix_dialect", unix_dialect)

The above code is the excel class dialect with '\n' line termination and
quoting of all fields. This allows for easy csv file import into mysql
databases.
History
Date User Action Args
2009-05-08 22:31:10jtalbotsetrecipients: + jtalbot
2009-05-08 22:31:10jtalbotsetmessageid: <1241821870.32.0.544896440632.issue5975@psf.upfronthosting.co.za>
2009-05-08 22:31:08jtalbotlinkissue5975 messages
2009-05-08 22:31:08jtalbotcreate