Created
September 19, 2019 07:51
-
-
Save alces/dc9904376e1cac2336276599c57f6120 to your computer and use it in GitHub Desktop.
Remove old schemes from Confluent Schema Registry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Cleanup old schemas from schema registry | |
import httplib | |
import json | |
import re | |
DELETE_REGEX = 'IT6[0-6][0-9]-' | |
con = httplib.HTTPConnection('127.0.0.1', 8081) | |
con.request('GET', '/subjects') | |
rsp = con.getresponse() | |
subjects = json.loads(rsp.read()) | |
con.close() | |
for subj in subjects: | |
if re.search(DELETE_REGEX, subj): | |
con = httplib.HTTPConnection('127.0.0.1', 8081) | |
con.request('DELETE', '/subjects/%s' % subj) | |
rsp = con.getresponse() | |
print 'Delete %s status %d' % (subj, rsp.status) | |
con.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment