Hey, I'm new with database interactions in Python and I'm not sure if I'm handling the cursor and transactions correctly: ++++++++ cursor = db.cursor(MySQLdb.cursors.DictCursor) cursor.execute(flate_rate_pkgs_sql) rows = cursor.fetchall() #I have for loop here to iterate over rows cursor.execute() rows = cursor.fetchall() # some more cursor.execute() calls but only SQL select statements # here is another for loop that contains try block # here are cursor.execute() calls, both insert and update db.commit() # in the except code block, I use db.rollback() ++++++++ As you see, my script contains only one db object and one cursor object and both the db and cursor objects are used multiple times, it is ok? As you might figured, this is a script for reports :) Thanks.
-- http://mail.python.org/mailman/listinfo/python-list