classification
Title: csv unix file format ('\n' line terminator)
Type: enhancement Stage:
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, jtalbot, terry.reedy
Priority: normal Keywords:

Created on 2009-05-08 22:31 by jtalbot, last changed 2010-10-27 07:27 by georg.brandl. This issue is now closed.

Messages (4)
msg87479 - (view) Author: Jay Talbot (jtalbot) Date: 2009-05-08 22:31
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.
msg87830 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2009-05-15 20:23
New features must be targeted at 2.7/3.2.  2.5 is in security-fix only
mode and 2.6 in bug-fix only mode, as is 3.0.  3.1 is in beta with new
features pretty well frozen.
msg87841 - (view) Author: Jay Talbot (jtalbot) Date: 2009-05-15 21:45
I'm sorry. I will remember to try and look up where the new features are
being targeted. Reporting bugs and requesting new features here is new
to me. Everyone seems to have their own rules.
msg119678 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-10-27 07:27
Added in r85856.
History
Date User Action Args
2010-10-27 07:27:23georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg119678

resolution: fixed
2009-05-15 21:45:08jtalbotsetmessages: + msg87841
2009-05-15 20:23:27terry.reedysetnosy: + terry.reedy

messages: + msg87830
versions: + Python 2.7, Python 3.2, - Python 2.6, Python 2.5, Python 3.0
2009-05-08 22:31:08jtalbotcreate