confluentinc / confluentinc/confluent-kafka-python

SR API coverage still not quite complete when it comes to soft/hard delete

Open
#1,912 2 comments 0 reactions 1 assignee Claimed by @naxinf View on GitHub
component:schema-registry enhancement priority:high
Dominant language
Python
Stars
509
Forks
964
Avg merge
2d 2h
Merged PRs (30d)
14

Description

Hi,

there are still two more issues wrt SR API coverage when it comes to soft/hard delete.

1) get_subjects()
Does not support the boolean "deleted" parameter. In the SR API, you can get a combined list of non-deleted subjects and soft-deleted ones by adding "?deleted=True". This is not yet supported in the Python wrapper.

2) delete_versions()
It does support the parameter boolean "permanent", but there seems to be a bug in the internal caching. When I first delete a schema version (soft) and then try to trigger a hard-delete, I end up with:

`Traceback (most recent call last):
File "/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 58, in testPartExecutor
yield
File "/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 651, in run
self._callTestMethod(testMethod)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/unittest/case.py", line 606, in _callTestMethod
if method() is not None:
~~~~~~^^
File "/Users/m0724822/kafka/kafi/test/test_single_storage_base.py", line 1278, in test_sr_two_versions
version_int = s.delete_version(key_subject_name_str, 1, permanent=True)
File "/Users/m0724822/kafka/kafi/kafi/schemaregistry.py", line 151, in delete_version
schema_id_int = self.schemaRegistryClient.delete_version(subject_name_str, version_int, permanent=permanent_bool)
File "/Users/m0724822/kafka/kafi/venv/lib/python3.13/site-packages/confluent_kafka/schema_registry/schema_registry_client.py", line 976, in delete_version
self._cache.remove_by_subject_version(subject_name, version)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/m0724822/kafka/kafi/venv/lib/python3.13/site-packages/confluent_kafka/schema_registry/schema_registry_client.py", line 509, in remove_by_subject_version
del self.rs_schema_index[subject][schema_id]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 5`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.