using multiple cursors in a nested loop in sqlite3 from python-2.7,db.commit()