Inserts/updates the given events into MySQL

def upsert(self, events):
        """Inserts/updates the given events into MySQL"""
        existing = self.get_existing_keys(events)
        inserts = [e for e in events if not e[self.key] in existing]
        updates = [e for e in events if e[self.key] in existing]
        self.insert(inserts)
        self.update(updates)