I’m using gevent with gevent-mysql (I also used pymysql to the same effect). It does selects just fine but no matter what I do I can’t get it to run an insert. I’m out of ideas.
conn = geventmysql.connect(host='localhost', port=3306, user='root', db='content')
cur = conn.cursor()
cur.execute("insert into placement (placement_name, some_id) values ('static', 1)")
cur.close()
conn.close()
If you are using a transactional storage engine (like InnoDB), you should check the value of the
autocommitvariable: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_autocommitIf it is
0, you need to commit your transactions, either using a built incommit()method or anexecute("COMMIT")call.