title: MySQLdb AttributeError: 'module' object has no attribute 'commit'
body: <p>I am trying to connect to and insert into a MySQL database on my machine following <a href="http://www.tutorialspoint.com/python/python_database_access.htm" rel="nofollow noreferrer">this tutorial</a> and I am stumped. Everything seems to look good up until the point where the the change is actually committed. I am getting an error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "write.py", line 18, in &lt;module&gt;
      db.commit()
  AttributeError: 'module' object has no attribute 'commit'
  </code></pre>
  
  <p>I have followed <a href="https://stackoverflow.com/a/25920020/2357169">these instructions</a> to install Python on my Mac and my code looks like this: </p>
  
  <pre><code>#!usr/bin/python
  
  import MySQLdb as db
  
  try:
      con = db.connect(host='localhost', user='trevor', passwd='pw', db='aqi');
  
      cur = con.cursor()
  
      sql_statement = """INSERT INTO aqi(datetime, no2, o3, so2, co, pm10, pm25, aqi, health_range)
                         VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)"""
      print sql_statement
  
      cur.execute(sql_statement, ("some date", 13.2, 53.5, 45.4, 31.1, 31.1, 32.3, 33.4, "healthy"))
  
      db.commit()
  
  except db.Error, e:
  
      print "Error %d: %s" % (e.args[0],e.args[1])
      sys.exit(1)
  
  finally:
  
    if con:
      con.close()
  </code></pre>
  
  <p>I haven't found any reference to this type of error anywhere and it really doesn't make sense. I would really appreciate any help or direction. Thanks!</p>