title: Python CSV to SQLite
body: <p>I am "converting" a large (~1.6GB) CSV file and inserting specific fields of the CSV into a SQLite database. Essentially my code looks like:</p>
  
  <pre><code>import csv, sqlite3
  
  conn = sqlite3.connect( "path/to/file.db" )
  conn.text_factory = str  #bugger 8-bit bytestrings
  cur = conn.cur()
  cur.execute('CREATE TABLE IF NOT EXISTS mytable (field2 VARCHAR, field4 VARCHAR)')
  
  reader = csv.reader(open(filecsv.txt, "rb"))
  for field1, field2, field3, field4, field5 in reader:
    cur.execute('INSERT OR IGNORE INTO mytable (field2, field4) VALUES (?,?)', (field2, field4))
  </code></pre>
  
  <p>Everything works as I expect it to with the exception... IT TAKES AN INCREDIBLE AMOUNT OF TIME TO PROCESS.  Am I coding it incorrectly?  Is there a better way to achieve a higher performance and accomplish what I'm needing (simply convert a few fields of a CSV into SQLite table)?</p>
  
  <p>**EDIT -- I tried directly importing the csv into sqlite as suggested but it turns out my file has commas in fields (e.g. <code>"My title, comma"</code>).  That's creating errors with the import.  It appears there are too many of those occurrences to manually edit the file... </p>
  
  <p>any other thoughts??**</p>