diff --git a/src/sqltrie/sqlite/sqlite.py b/src/sqltrie/sqlite/sqlite.py index fa900e1..2e4ce32 100644 --- a/src/sqltrie/sqlite/sqlite.py +++ b/src/sqltrie/sqlite/sqlite.py @@ -293,7 +293,7 @@ def has_node(self, key: TrieKey) -> bool: def delete_node(self, key: TrieKey): node = self._get_node(key) - del self._ids[key] + self._ids.pop(key, None) self._conn.execute( """ DELETE FROM nodes WHERE id = ?