Changes made using pymysql don't "persist" to database
Question: I am trying to Insert Into a mysql database using pymysql. After the Insert
and calling commit, as a demo, I Select and print all rows. The new row is
printed, but - only the last added row is displayed (printed) and the
auto_incremented Id field increments but only one row is displayed regardless
of how many time I run the code. No rows are visible in mysql command line
select or in the Sequel Pro "Contents" tab. I believe I have reviewed all the
pertinent "Similar Questions"

Thanks.

    
    
    import pymysql
    
    connCost = pymysql.connect(host='127.0.0.1', port=3306, user='*****', passwd='********', db='CU_COST')
    testCur = connCost.cursor()
    vF1 = 321
    vF2 = '/zero#'
    # Transaction implictily started?
    query = "Insert Into testInsert (F1, F2) Values(" + str(vF1) + ", '" + vF2 +"')"
    testCur.execute(query)
    connCost.commit
    testCur.execute("Select * From testInsert")
    rows = testCur
    for row in rows:
       print row
    
    testCur.close
    connCost.close
    

Result of print (after running the code 9 times):

    
    
    2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
    Python Type "help", "copyright", "credits" or "license" for more information.
    [evaluate testInsert2.py]
    (9, 321, '/zero#')
    


Answer: Commit is a function. Therefore you must call it as such:

    
    
    connCost.commit()
    

That should fix it.

