title: Python/MySQL - import csv data into mysql table
body: <p>I am developing a python application to insert data in my db, through a .csv file. However when importing the file the following error appears:</p>
  
  <pre><code>Warning: (1262, 'Row 1 was truncated; it contained more data than there were input columns')
    result = self._query(query)
  </code></pre>
  
  <p>Basically for all lines in csv file. 
  The data inside the file is as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/eIUDd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eIUDd.png" alt="enter image description here"></a></p>
  
  <p>I can import that same way directly into the Workbench, but i would like to do it via the application.</p>
  
  <p>Follow the code below:</p>
  
  <pre><code>from tkinter import *
  import pymysql
  import os
  import os.path
  
  tess = Tk()
  
  def import_file():
  
      conn = pymysql.connect(host='localhost', port=3306, user='root', password='', db='omnia')
      print('connect successfull!')
  
  
  
      if os.path.exists('C:/temp/teste.csv'):
          statm = "LOAD DATA INFILE 'C:/temp/teste.csv' INTO TABLE testtable FIELDS TERMINATED BY ','"
          cursor = conn.cursor()
          cursor.execute(statm)
  
  bt = Button(tess, text='browse file')
  bt.place(x=10, y=10)
  
  bt = Button(tess, text='import file', command=import_file)
  bt.place(x=10, y=45)
  
  tess.mainloop()
  </code></pre>
  
  <p>And also the table:</p>
  
  <pre><code>create table testTable(
      n_id int not null auto_increment,
      c_nome varchar(255),
      c_depto varchar(255),
      n_salario float,
       primary key (n_id));
  </code></pre>