I got about a 10% speedup patching execute_insert to use sqlite3's cursor.lastrowid, and another 3% and cleaner code if I remove the tuple (at the expense of the api returning an object of a different shape)
def execute_insert(self, sql: str, parameters: Any) -> Optional[tuple[int]]:
cursor = self._conn.execute(sql, parameters)
return (cursor.lastrowid,)
I got about a 10% speedup patching execute_insert to use sqlite3's cursor.lastrowid, and another 3% and cleaner code if I remove the tuple (at the expense of the api returning an object of a different shape)