title: Out of range value for column 'date' when executing my python script
body: <p>I have created a python script that reads a csv file and then stores the data into variables using a dictionary.
  then I insert the variables to mysql database.
  Everytime is working 100% .. except when I try to insert a date.</p>
  
  <p>i get the error:</p>
  
  <blockquote>
    <p>Out of range value for column 'date'</p>
  </blockquote>
  
  <p>I printed the variable date which is: 2015-02-28 
  it is exactly what I need! but I still get the error message..
  Also, it inserts the value 0000-00-00 instead of 2015-02-28 to my table :s 
  I think the problems is that 2015-02-28 might be a string.. how can i convert it to date?</p>
  
  <p>This is my python script:</p>
  
  <pre><code>#4 python script to insert all data to mysql
  
  #!/usr/bin/python
  from StringIO import StringIO
  import numpy as np
  import csv
  import MySQLdb
  import os
  from datetime import datetime,date,timedelta
  
  dict= {}
  infile= open('csv_err1.log','r')
  lines= infile.readlines()
  for i in lines:
      eventKey, count, totalDuration, average   = [a.strip() for a in i.split(',')]
      dict.setdefault(eventKey, []).append((int(count), int(totalDuration), float(average)))
  
  date = date.today() - timedelta(1)
  
  app_launch_time =dict["app_launch_time"][0][0]
  bup_login_error =dict["bup_login_error"][0][0]
  crash =dict["crash"][0][0]
  parental_controls_error =dict["parental_controls_error"][0][0]
  playback_error =dict["playback_error"][0][0]
  qp_library_failed_reauthentication =dict["qp_library_failed_reauthentication"][0][0]
  qp_library_failed_to_start =dict["qp_library_failed_to_start"][0][0]
  search_error =dict["search_error"][0][0]
  video_load_time =dict["video_load_time"][0][0]
  tbr_error =dict["tbr_error"][0][0]
  live_channels_metadata_request_failed =dict["live_channels_metadata_request_failed"][0][0]
  vod_catalog_metadata_request_failed =dict["vod_catalog_metadata_request_failed"][0][0]
  
  app_launch_time_avg =dict["app_launch_time"][0][2]
  video_load_time_avg =dict["video_load_time"][0][2]
  
  print date
  
  # Open database connection
  db = MySQLdb.connect(host="localhost",user="root",passwd="bravoecholimalima",db="capacityreports_mobiletv")
  
  cursor = db.cursor()
  
  # Prepare SQL query to INSERT a record into the database.
  sql = ("""INSERT INTO errorscounted (date,app_launch_time,bup_login_error,crash, parental_controls_error,playback_error,qp_library_failed_reauthentication,qp_library_failed_to_start,search_error,video_load_time,tbr_error,live_channels_metadata_request_failed,vod_catalog_metadata_request_failed,app_launch_time_avg,video_load_time_avg) VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""" %(date,app_launch_time, bup_login_error, crash, parental_controls_error,playback_error,qp_library_failed_reauthentication,qp_library_failed_to_start,search_error,video_load_time,tbr_error,live_channels_metadata_request_failed,vod_catalog_metadata_request_failed,app_launch_time_avg,video_load_time_avg))
  
  
  try:
     # Execute the SQL command
     cursor.execute(sql)
     # Commit your changes in the database
     db.commit()
     for row in cursor.fetchall():
      print row[0]
  
  except:
     # Rollback in case there is any error
     db.rollback()
  
  # disconnect from server
  cursor.close()
  db.close()
  </code></pre>
  
  <p>any help or pointers would be greatly appreciated :)</p>
  
  <p>edit:
  this is my csv_err1.log file:</p>
  
  <pre><code>app_launch_time,12247,118616277,9685.33
  video_load_time,12966,123702815,9540.55
  eventKey,2,0,0
  playback_error,3773,0,0
  qp_library_failed_reauthentication,230,0,0
  search_error,183,0,0
  epg_metadata_request_failed,5,0,0
  live_channels_metadata_request_failed,13,0,0
  vod_catalog_metadata_request_failed,1,0,0
  bup_login_error,20,0,0
  qp_library_failed_to_start,295,0,0
  0,9,0,0
  tbr_error,389,0,0
  crash,218,0,0
  parental_controls_error,123,0,0
  </code></pre>