Import csv files containing data with commas into MySQL
Question: I have more than 10GB .csv files. I m trying to import the data from these
files into MySQL using python. Since csv files are comma separated files, and
I have data which itself contains commas, therefore I can not use ',' here for
splitting. There please suggest some other option for splitting the csv file.
I want to import the data from the csv file(where the data itself contains
comma) to MySQL (i am using Wamp server for the same). I have data like
'london, u.k.', '2010', 'credit, saving'


Answer: A good answer has been provided for importing using Python. But I'm unclear as
to why you need Python to do it. MySQL has built-in commands for importing CSV
data---see the [load data](http://dev.mysql.com/doc/refman/5.0/en/load-
data.html) manual page. For example,

    
    
    LOAD DATA LOCAL INFILE 'source_data.csv'
    INTO TABLE my_table
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    IGNORE 1 LINES;
    

That last part ignores the first line (use if your CSV file has a "header").

