Skip to content

Add bool for permanent delete #1029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/confluent_kafka/schema_registry/schema_registry_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,15 @@ def get_subjects(self):
""" # noqa: E501
return self._rest_client.get('subjects')

def delete_subject(self, subject_name):
def delete_subject(self, subject_name, permanent=False):
"""
Deletes the specified subject and its associated compatibility level if
registered. It is recommended to use this API only when a topic needs
to be recycled or in development environments.

Args:
subject_name (str): subject name
permanent (bool): True for a hard delete, False (default) for a soft delete

Returns:
list(int): Versions deleted under this subject
Expand All @@ -457,9 +458,15 @@ def delete_subject(self, subject_name):
`DELETE Subject API Reference <https://docs.confluent.io/current/schema-registry/develop/api.html#delete--subjects-(string-%20subject)>`_

""" # noqa: E501
return self._rest_client.delete('subjects/{}'
list = self._rest_client.delete('subjects/{}'
.format(_urlencode(subject_name)))

if permanent:
self._rest_client.delete('subjects/{}?permanent=true'
.format(_urlencode(subject_name)))

return list

def get_latest_version(self, subject_name):
"""
Retrieves latest registered version for subject
Expand Down