import SQLForce session = SQLForce.Session("production" ) session.setenv('QUERY_ALL', "true" ) # Force archived records to be read. ## ## SOQL that determines what records to delete. BE VERY CAREFUL HERE! ##s taskSOQL = """SELECT id, subject FROM Task WHERE isDeleted=false AND subject LIKE 'Genius e-mail %' order by systemmodstamp DESC""" nDeleted = 0 maxPerBatch = 1000 # This is a good size to prevent the Task query from timing out. maxPerRun = 50000 # quit once this number of deletes has happened. while True: idsToDelete =  soql = taskSOQL + " LIMIT " + str(maxPerBatch) print(soql) for rec in session.selectRecords(soql): idsToDelete.append( rec.id ) if not idsToDelete: break nThisTime = session.delete('Task', idsToDelete ) nDeleted += nThisTime print("Deleted " + str(nDeleted) + " records so far") if nDeleted >= maxPerRun: break print("Finished")
The only tricky part is the SOQL that selects tasks to delete. Get this one wrong and you can do major damage to your Salesforce instance quickly.
The Python I used, SQLForce, is freely available to anyone. There's nothing but good news with SQLForce/Python.