title: convert data type and then load data into Mysql by Python
body: <p>Besides <code>LOAD DATA INFILE</code> command, is there any other way to read a .txt file which contains three columns into Mysql? I want to read the data line by line and put them into a table in Mysql.</p>
  
  <p>It is impossible to convert the datatype in the following<code>LOAD DATA INFILE</code> command, right? </p>
  
  <p><code>LOAD DATA INFILE 'filename' into TABLE info (col1, col2, col3)</code> </p>
  
  <p>My data sample is like this:</p>
  
  <pre><code>123456.123455   dsfd  wqoe   
  123455.123237   dert  2222
  098878.938475   lkjf  2346
  </code></pre>
  
  <p>So before I load the data into Mysql, I need to convert the first column from unix time into datetime since the data type of the first column in Mysql is <code>DATETIME</code>, I want to use <code>FROM_UNIXTIME</code> to solve this problem. But how can I use a python variable as the <code>fieldname</code> in <code>FROM_UNIXTIME(fieldname)</code>which is a Mysql command?</p>
  
  <p>UPDATED:
  This is my solution
  I have three columns in the table <code>video</code>, they are <code>datetime, src_ip, video_id</code> respectively
  The problem is, @unixtime variable can only save one value or? since now my first column in mysql are exactly the same, maybe it equals to the very last result..how can I solve this?</p>
  
  <p><code>insertQuery = "LOAD DATA LOCAL INFILE 'all-filter.txt' INTO TABLE video (@unixtime, src_ip, video_id); UPDATE video SET datetime=FROM_UNIXTIME(@unixtime)"</code></p>