Skip to content

Commit 37f6e49

Browse files
rnpridgeonRyan P
authored andcommitted
Add Delete schema support to CachedSchemaRegistryClient
1 parent 61a53ea commit 37f6e49

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

confluent_kafka/avro/cached_schema_registry_client.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,22 @@ def register(self, subject, avro_schema):
226226
self._cache_schema(avro_schema, schema_id, subject)
227227
return schema_id
228228

229+
def delete_subject(self, subject):
230+
"""
231+
DELETE /subjects/(string: subject)
232+
Deletes the specified subject and its associated compatibility level if registered.
233+
It is recommended to use this API only when a topic needs to be recycled or in development environments.
234+
@:param: subject: subject name
235+
@:returns: version (int) - version of the schema deleted under this subject
236+
"""
237+
238+
url = '/'.join([self.url, 'subjects', subject])
239+
240+
result, code = self._send_request(url, method="DELETE")
241+
if not (code >= 200 and code <= 299):
242+
raise ClientError('Unable to delete subject: %d' % result)
243+
return result
244+
229245
def get_by_id(self, schema_id):
230246
"""
231247
GET /schemas/ids/{int: id}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy